mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 13:10:29 +00:00
feat(collections): "want to revisit" status for saved places (#2567)
A fourth status after visited, for a place already seen that the user wants to go back to. It joins the one-tap cycle, the filters, the pickers, the assistant cards and the MCP status tool, and counts as visited wherever visits are counted (isVisitedCollectionStatus), so "visited everywhere" keeps it. The status pickers go two by two where four would not fit.
This commit is contained in:
@@ -45,8 +45,15 @@ export const collectionCardListSchema = z.object({
|
||||
placeCount: cardCountSchema.nullable(),
|
||||
/** Accepted members besides the owner. */
|
||||
memberCount: cardCountSchema,
|
||||
/** Places per status, only where the whole list was read. */
|
||||
counts: z.object({ idea: cardCountSchema, want: cardCountSchema, visited: cardCountSchema }).nullable(),
|
||||
/** Places per status, only where the whole list was read. A card saved before 'revisit' existed reads 0 there. */
|
||||
counts: z
|
||||
.object({
|
||||
idea: cardCountSchema,
|
||||
want: cardCountSchema,
|
||||
visited: cardCountSchema,
|
||||
revisit: cardCountSchema.default(0),
|
||||
})
|
||||
.nullable(),
|
||||
});
|
||||
export type CollectionCardList = z.infer<typeof collectionCardListSchema>;
|
||||
|
||||
|
||||
@@ -5,10 +5,28 @@ import {
|
||||
collectionPlaceUpdateRequestSchema,
|
||||
collectionReorderRequestSchema,
|
||||
collectionSavePlaceRequestSchema,
|
||||
collectionStatusSchema,
|
||||
isVisitedCollectionStatus,
|
||||
} from './collection.schema';
|
||||
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
describe('collectionStatusSchema', () => {
|
||||
// #2567: "want to revisit" is a status of its own, stored as it is.
|
||||
it('accepts revisit next to the first three', () => {
|
||||
for (const status of ['idea', 'want', 'visited', 'revisit'] as const) {
|
||||
expect(collectionStatusSchema.parse(status)).toBe(status);
|
||||
}
|
||||
});
|
||||
|
||||
it('counts revisit as visited, and nothing before it', () => {
|
||||
expect(isVisitedCollectionStatus('visited')).toBe(true);
|
||||
expect(isVisitedCollectionStatus('revisit')).toBe(true);
|
||||
expect(isVisitedCollectionStatus('want')).toBe(false);
|
||||
expect(isVisitedCollectionStatus('idea')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('collectionPlaceUpdateRequestSchema', () => {
|
||||
// Regression for #1437: an update that omits `status` must NOT inject a default
|
||||
// of 'idea', otherwise the server overwrites the stored status on every edit-save.
|
||||
|
||||
@@ -9,10 +9,20 @@ import { tagSchema } from '../tag/tag.schema';
|
||||
|
||||
import { z } from 'zod';
|
||||
|
||||
export const COLLECTION_STATUSES = ['idea', 'want', 'visited'] as const;
|
||||
/**
|
||||
* A saved place's status, in the order the one-tap cycle walks. 'revisit' (#2567)
|
||||
* is a place already visited that the user wants to go back to; it sits last so
|
||||
* the stored values and the order of the first three stay as they were.
|
||||
*/
|
||||
export const COLLECTION_STATUSES = ['idea', 'want', 'visited', 'revisit'] as const;
|
||||
export const collectionStatusSchema = z.enum(COLLECTION_STATUSES).catch('idea').default('idea');
|
||||
export type CollectionStatus = (typeof COLLECTION_STATUSES)[number];
|
||||
|
||||
/** Whether the status means "been there": a place to revisit counts as visited wherever visits are counted. */
|
||||
export function isVisitedCollectionStatus(status: CollectionStatus): boolean {
|
||||
return status === 'visited' || status === 'revisit';
|
||||
}
|
||||
|
||||
/** Per-member permission on a shared list. viewer = read + copy-to-trip only;
|
||||
* editor (default) = add + edit places; admin = full incl. delete. The owner
|
||||
* is always full and is not a member row. */
|
||||
|
||||
@@ -154,6 +154,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'فكرة',
|
||||
'collections.status.want': 'أريد الذهاب',
|
||||
'collections.status.visited': 'تمت الزيارة',
|
||||
'collections.status.revisit': 'أريد العودة',
|
||||
'collections.status.filterAll': 'الكل',
|
||||
'collections.status.cycleHint': 'انقر للتغيير',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'İdeya',
|
||||
'collections.status.want': 'Getmək istəyirəm',
|
||||
'collections.status.visited': 'Ziyarət edilib',
|
||||
'collections.status.revisit': 'Yenidən getmək istəyirəm',
|
||||
'collections.status.filterAll': 'Hamısı',
|
||||
'collections.status.cycleHint': 'dəyişmək üçün toxunun',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ideia',
|
||||
'collections.status.want': 'Quero ir',
|
||||
'collections.status.visited': 'Visitado',
|
||||
'collections.status.revisit': 'Quero voltar',
|
||||
'collections.status.filterAll': 'Todos',
|
||||
'collections.status.cycleHint': 'toque para alterar',
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idea', // same-as-en
|
||||
'collections.status.want': 'Hi vull anar',
|
||||
'collections.status.visited': 'Visitat',
|
||||
'collections.status.revisit': 'Hi vull tornar',
|
||||
'collections.status.filterAll': 'Tot',
|
||||
'collections.status.cycleHint': 'toca per canviar',
|
||||
|
||||
|
||||
@@ -117,6 +117,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Nápad',
|
||||
'collections.status.want': 'Chci navštívit',
|
||||
'collections.status.visited': 'Navštíveno',
|
||||
'collections.status.revisit': 'Chci se vrátit',
|
||||
'collections.status.filterAll': 'Vše',
|
||||
'collections.status.cycleHint': 'klepnutím změníte',
|
||||
|
||||
|
||||
@@ -107,6 +107,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idee',
|
||||
'collections.status.want': 'Will hin',
|
||||
'collections.status.visited': 'Besucht',
|
||||
'collections.status.revisit': 'Will wieder hin',
|
||||
'collections.status.filterAll': 'Alle',
|
||||
'collections.status.cycleHint': 'tippen zum Ändern',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idea',
|
||||
'collections.status.want': 'Want to go',
|
||||
'collections.status.visited': 'Visited',
|
||||
'collections.status.revisit': 'Want to revisit',
|
||||
'collections.status.filterAll': 'All',
|
||||
'collections.status.cycleHint': 'tap to change',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idea', // same-as-en
|
||||
'collections.status.want': 'Quiero ir',
|
||||
'collections.status.visited': 'Visitado',
|
||||
'collections.status.revisit': 'Quiero volver',
|
||||
'collections.status.filterAll': 'Todos',
|
||||
'collections.status.cycleHint': 'toca para cambiar',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idee',
|
||||
'collections.status.want': 'Tahan minna',
|
||||
'collections.status.visited': 'Külastatud',
|
||||
'collections.status.revisit': 'Tahan tagasi minna',
|
||||
'collections.status.filterAll': 'Kõik',
|
||||
'collections.status.cycleHint': 'muutmiseks puuduta',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idée',
|
||||
'collections.status.want': 'À visiter',
|
||||
'collections.status.visited': 'Visité',
|
||||
'collections.status.revisit': 'À revisiter',
|
||||
'collections.status.filterAll': 'Tous',
|
||||
'collections.status.cycleHint': 'touchez pour changer',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ιδέα',
|
||||
'collections.status.want': 'Θέλω να πάω',
|
||||
'collections.status.visited': 'Επισκέφθηκα',
|
||||
'collections.status.revisit': 'Θέλω να ξαναπάω',
|
||||
'collections.status.filterAll': 'Όλα',
|
||||
'collections.status.cycleHint': 'πάτησε για αλλαγή',
|
||||
|
||||
|
||||
@@ -113,6 +113,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'רעיון',
|
||||
'collections.status.want': 'רוצה ללכת',
|
||||
'collections.status.visited': 'ביקרתי',
|
||||
'collections.status.revisit': 'רוצה לחזור',
|
||||
'collections.status.filterAll': 'הכל',
|
||||
'collections.status.cycleHint': 'הקישו לשינוי',
|
||||
'collections.markVisited': 'סימון כביקרתי',
|
||||
|
||||
@@ -107,6 +107,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ötlet',
|
||||
'collections.status.want': 'Szeretnék odamenni',
|
||||
'collections.status.visited': 'Meglátogatva',
|
||||
'collections.status.revisit': 'Szeretnék visszamenni',
|
||||
'collections.status.filterAll': 'Összes',
|
||||
'collections.status.cycleHint': 'koppints a módosításhoz',
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ide',
|
||||
'collections.status.want': 'Ingin ke sana',
|
||||
'collections.status.visited': 'Dikunjungi',
|
||||
'collections.status.revisit': 'Ingin kembali',
|
||||
'collections.status.filterAll': 'Semua',
|
||||
'collections.status.cycleHint': 'ketuk untuk mengubah',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idea', // same-as-en
|
||||
'collections.status.want': 'Da visitare',
|
||||
'collections.status.visited': 'Visitato',
|
||||
'collections.status.revisit': 'Da rivisitare',
|
||||
'collections.status.filterAll': 'Tutti',
|
||||
'collections.status.cycleHint': 'tocca per cambiare',
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'アイデア',
|
||||
'collections.status.want': '行きたい',
|
||||
'collections.status.visited': '訪問済み',
|
||||
'collections.status.revisit': 'また行きたい',
|
||||
'collections.status.filterAll': 'すべて',
|
||||
'collections.status.cycleHint': 'タップで変更',
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': '아이디어',
|
||||
'collections.status.want': '가고 싶은 곳',
|
||||
'collections.status.visited': '방문함',
|
||||
'collections.status.revisit': '다시 가고 싶은 곳',
|
||||
'collections.status.filterAll': '전체',
|
||||
'collections.status.cycleHint': '탭하여 변경',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idee',
|
||||
'collections.status.want': 'Wil heen',
|
||||
'collections.status.visited': 'Bezocht',
|
||||
'collections.status.revisit': 'Wil terug',
|
||||
'collections.status.filterAll': 'Alle',
|
||||
'collections.status.cycleHint': 'tik om te wijzigen',
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Pomysł',
|
||||
'collections.status.want': 'Chcę odwiedzić',
|
||||
'collections.status.visited': 'Odwiedzone',
|
||||
'collections.status.revisit': 'Chcę wrócić',
|
||||
'collections.status.filterAll': 'Wszystkie',
|
||||
'collections.status.cycleHint': 'dotknij, aby zmienić',
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Идея',
|
||||
'collections.status.want': 'Хочу посетить',
|
||||
'collections.status.visited': 'Посещено',
|
||||
'collections.status.revisit': 'Хочу вернуться',
|
||||
'collections.status.filterAll': 'Все',
|
||||
'collections.status.cycleHint': 'нажмите, чтобы изменить',
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Nápad',
|
||||
'collections.status.want': 'Chcem navštíviť',
|
||||
'collections.status.visited': 'Navštívené',
|
||||
'collections.status.revisit': 'Chcem sa vrátiť',
|
||||
'collections.status.filterAll': 'Všetko',
|
||||
'collections.status.cycleHint': 'klepnutím zmeníte',
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Idé',
|
||||
'collections.status.want': 'Vill besöka',
|
||||
'collections.status.visited': 'Besökt',
|
||||
'collections.status.revisit': 'Vill tillbaka',
|
||||
'collections.status.filterAll': 'Alla',
|
||||
'collections.status.cycleHint': 'tryck för att ändra',
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'ไอเดีย',
|
||||
'collections.status.want': 'อยากไป',
|
||||
'collections.status.visited': 'เยี่ยมชมแล้ว',
|
||||
'collections.status.revisit': 'อยากกลับไปอีก',
|
||||
'collections.status.filterAll': 'ทั้งหมด',
|
||||
'collections.status.cycleHint': 'แตะเพื่อเปลี่ยน',
|
||||
|
||||
|
||||
@@ -106,6 +106,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Fikir',
|
||||
'collections.status.want': 'Gitmek istiyorum',
|
||||
'collections.status.visited': 'Gidildi',
|
||||
'collections.status.revisit': 'Tekrar gitmek istiyorum',
|
||||
'collections.status.filterAll': 'Tümü',
|
||||
'collections.status.cycleHint': 'değiştirmek için dokun',
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ідея',
|
||||
'collections.status.want': 'Хочу відвідати',
|
||||
'collections.status.visited': 'Відвідано',
|
||||
'collections.status.revisit': 'Хочу повернутися',
|
||||
'collections.status.filterAll': 'Усі',
|
||||
'collections.status.cycleHint': 'торкніться, щоб змінити',
|
||||
|
||||
|
||||
@@ -94,6 +94,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': 'Ý tưởng',
|
||||
'collections.status.want': 'Muốn đến',
|
||||
'collections.status.visited': 'Đã đến',
|
||||
'collections.status.revisit': 'Muốn quay lại',
|
||||
'collections.status.filterAll': 'Tất cả',
|
||||
'collections.status.cycleHint': 'chạm để thay đổi',
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': '想法',
|
||||
'collections.status.want': '想去',
|
||||
'collections.status.visited': '已造訪',
|
||||
'collections.status.revisit': '想再去',
|
||||
'collections.status.filterAll': '全部',
|
||||
'collections.status.cycleHint': '點按切換',
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ const collection: TranslationStrings = {
|
||||
'collections.status.idea': '想法',
|
||||
'collections.status.want': '想去',
|
||||
'collections.status.visited': '已去过',
|
||||
'collections.status.revisit': '想再去',
|
||||
'collections.status.filterAll': '全部',
|
||||
'collections.status.cycleHint': '点按切换',
|
||||
|
||||
|
||||
Reference in New Issue
Block a user