Skip to content

Commit

Permalink
Fix visited-tab.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad committed Mar 22, 2024
1 parent 875ff95 commit bf6b453
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/app/[locale]/(app)/profile/_components/tabs/visited-tab.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useLocale, useTranslations } from 'next-intl'
import { FC } from 'react'
import { FC, useMemo } from 'react'
import { onlyTranslatableLocales } from '~/i18n'
import { trpc } from '~/trpc'
import { PlaceList } from '../../../explore/search/_components/place-list'
Expand All @@ -11,18 +11,27 @@ export const VisitedTab: FC = () => {
locale: onlyTranslatableLocales(locale),
})

const placesWithTypes = useMemo(
() =>
places?.map((place) => ({
type: 'place' as const,
...place,
})),
[places]
)

return (
<>
<h2 className="text-center font-title font-medium">
{t('visited-places')}
</h2>

{!places ? (
{!placesWithTypes ? (
<p className="mt-2 text-center text-gray-400">{t('loading')}</p>
) : places.length === 0 ? (
) : placesWithTypes.length === 0 ? (
<p className="mt-2 text-center text-gray-400">{t('no-places')}</p>
) : (
<PlaceList items={places} />
<PlaceList items={placesWithTypes} />
)}
</>
)
Expand Down

0 comments on commit bf6b453

Please sign in to comment.