diff --git a/client/src/components/Assistant/cards/collection/CollectionCardBlocks.test.tsx b/client/src/components/Assistant/cards/collection/CollectionCardBlocks.test.tsx index ca0e3fb5c..d965bd944 100644 --- a/client/src/components/Assistant/cards/collection/CollectionCardBlocks.test.tsx +++ b/client/src/components/Assistant/cards/collection/CollectionCardBlocks.test.tsx @@ -1,5 +1,5 @@ /** - * FE-AI-COLL-010 to FE-AI-COLL-017 + * FE-AI-COLL-010 to FE-AI-COLL-017, FE-AI-COLL-040 * * The answer cards of the collections as the chat draws them: a list's head * with its size, people and places per status, its saved places as rows @@ -57,6 +57,14 @@ describe('collection answer cards', () => { expect(view.onOpen).toHaveBeenCalledWith({ kind: 'page', path: '/collections/12' }); }); + it('FE-AI-COLL-040: the places to revisit have a pill of their own in the head, in the visited tone (#2567)', () => { + draw([placesCard({ list: { ...placesCard().list, counts: { idea: 3, want: 5, visited: 4, revisit: 7 } } })]); + const card = screen.getByRole('region', { name: 'Saved places in Paris food' }); + const pill = within(card).getByText('Want to revisit').parentElement as HTMLElement; + expect(within(pill).getByText('7')).toBeInTheDocument(); + expect(within(card).getByText('Visited').parentElement?.className).toBe(pill.className); + }); + it('FE-AI-COLL-011: a saved place shows its status, two labels and the rest counted, its rating and the trip having it', () => { draw([placesCard({ places: [savedPlace({ inTripPlaceId: 6 })] })]); expect(screen.getByText('Septime')).toBeInTheDocument(); diff --git a/client/src/components/Assistant/cards/collection/CollectionChangeSlots.tsx b/client/src/components/Assistant/cards/collection/CollectionChangeSlots.tsx index df309dab7..877a46e7a 100644 --- a/client/src/components/Assistant/cards/collection/CollectionChangeSlots.tsx +++ b/client/src/components/Assistant/cards/collection/CollectionChangeSlots.tsx @@ -1,10 +1,11 @@ -import type { - CollectionCardDelta, - CollectionCardLabel, - CollectionCardList, - CollectionCardPlace, - CollectionListsCard, - CollectionPlacesCard, +import { + type CollectionCardDelta, + type CollectionCardLabel, + type CollectionCardList, + type CollectionCardPlace, + type CollectionListsCard, + type CollectionPlacesCard, + isVisitedCollectionStatus, } from '@trek/shared'; import { Bookmark, Info, Tag } from 'lucide-react'; import type { ReactNode } from 'react'; @@ -110,7 +111,7 @@ function ListChip({ list }: { list: CollectionCardList }) { function statusChange(status: NonNullable, t: T): ReactNode { const to = STATUS_META[status.to]; const before = status.from ? t(STATUS_META[status.from].labelKey) : null; - const tone = status.to === 'visited' ? 'success' : 'neutral'; + const tone = isVisitedCollectionStatus(status.to) ? 'success' : 'neutral'; return ; } diff --git a/client/src/components/Assistant/cards/collection/collectionCardParts.tsx b/client/src/components/Assistant/cards/collection/collectionCardParts.tsx index 98c424fd3..1187599fe 100644 --- a/client/src/components/Assistant/cards/collection/collectionCardParts.tsx +++ b/client/src/components/Assistant/cards/collection/collectionCardParts.tsx @@ -1,10 +1,16 @@ -import type { CollectionCardLabel, CollectionCardList, CollectionCardPlace, CollectionStatus } from '@trek/shared'; +import { + type CollectionCardLabel, + type CollectionCardList, + type CollectionCardPlace, + type CollectionStatus, + isVisitedCollectionStatus, +} from '@trek/shared'; import { Star } from 'lucide-react'; import type { CSSProperties } from 'react'; import { useTranslation } from '../../../../i18n'; import { safeHexColor } from '../../../../utils/safeColor'; -import { STATUS_META } from '../../../Collections/collectionStatus'; +import { STATUS_META, STATUS_ORDER } from '../../../Collections/collectionStatus'; import { SoftPill, tintOf, WhiteBadge } from '../../../Planner/planParts'; import PlaceAvatar from '../../../shared/PlaceAvatar'; import { Tooltip } from '../../../shared/Tooltip'; @@ -93,7 +99,7 @@ export function StatusPill({ status, count }: { status: CollectionStatus; count?