diff --git a/app/collections/controllers/show_collections_controller.ts b/app/collections/controllers/show_collections_controller.ts index da82f28..3f32f44 100644 --- a/app/collections/controllers/show_collections_controller.ts +++ b/app/collections/controllers/show_collections_controller.ts @@ -19,10 +19,6 @@ export default class ShowCollectionsController { this.linkService.getFavoriteLinksForAuthenticatedUser(), ]); - if (collections.length === 0) { - return response.redirectToNamedRoute('collection.create-form'); - } - const activeCollection = collections.find( (c) => c.id === activeCollectionId ); diff --git a/inertia/components/dashboard/link/list/link_list.tsx b/inertia/components/dashboard/link/list/link_list.tsx index 2e96d60..67d37a3 100644 --- a/inertia/components/dashboard/link/list/link_list.tsx +++ b/inertia/components/dashboard/link/list/link_list.tsx @@ -1,5 +1,5 @@ import { DisplayPreferences } from '#shared/types/index'; -import { SimpleGrid, Stack, StyleProp, useCombobox } from '@mantine/core'; +import { SimpleGrid, Stack, StyleProp } from '@mantine/core'; import { LinkItem } from '~/components/dashboard/link/item/link_item'; import { NoLink } from '~/components/dashboard/link/no_link/no_link'; import { useActiveCollection } from '~/hooks/collections/use_active_collection'; @@ -15,13 +15,9 @@ export function LinkList({ hideMenu = false }: LinkListProps) { const favoriteLinks = useFavoriteLinks(); const { displayPreferences } = useDisplayPreferences(); - const combobox = useCombobox({ - onDropdownClose: () => combobox.resetSelectedOption(), - }); - const links = activeCollection?.links || favoriteLinks; - if (activeCollection?.links.length === 0) { + if (links.length === 0) { return ; } diff --git a/inertia/components/dashboard/link/no_link/no_link.tsx b/inertia/components/dashboard/link/no_link/no_link.tsx index e2c899b..29ff5aa 100644 --- a/inertia/components/dashboard/link/no_link/no_link.tsx +++ b/inertia/components/dashboard/link/no_link/no_link.tsx @@ -12,21 +12,27 @@ interface NoLinkProps extends LinkListProps {} export function NoLink({ hideMenu }: NoLinkProps) { const { t } = useTranslation('common'); const activeCollection = useActiveCollection(); + const isFavorite = !activeCollection?.id; + + const noLinkForCollection = t( + 'home:no-link', + { name: activeCollection?.name ?? '' } as any, + { + interpolation: { escapeValue: false }, + } + ); + + const noLinkForFavorite = t('home:no-link-favorite'); + return ( - {!hideMenu && ( + {!hideMenu && !isFavorite && ( {{name}}" + "select-collection": "Please select a collection", + "or-create-one": "or create one", + "no-link": "No link for {{name}}", + "no-link-favorite": "No favorite link" } diff --git a/inertia/i18n/locales/fr/home.json b/inertia/i18n/locales/fr/home.json index d61115d..a8444be 100644 --- a/inertia/i18n/locales/fr/home.json +++ b/inertia/i18n/locales/fr/home.json @@ -1,5 +1,6 @@ { - "select-collection": "Veuillez sélectionner une collection", - "or-create-one": "ou en créer une", - "no-link": "Aucun lien pour {{name}}" + "select-collection": "Veuillez sélectionner une collection", + "or-create-one": "ou en créer une", + "no-link": "Aucun lien pour {{name}}", + "no-link-favorite": "Aucun lien dans les favoris" } diff --git a/inertia/pages/dashboard.tsx b/inertia/pages/dashboard.tsx index 4241651..081d6de 100644 --- a/inertia/pages/dashboard.tsx +++ b/inertia/pages/dashboard.tsx @@ -39,24 +39,27 @@ export default function Dashboard() { disabled /> - {!isFavorite && ( - - {activeCollection?.visibility === Visibility.PUBLIC && ( - + + {!isFavorite && + activeCollection?.visibility === Visibility.PUBLIC && ( + <> + + + )} - - + + {!isFavorite && ( + )} - - - - )} + {!isFavorite && ( + <> + + + + )} + {displayPreferences.collectionListDisplay === 'inline' && !isMobile && (