diff --git a/inertia/components/dashboard/link/link.module.css b/inertia/components/dashboard/link/link.module.css index 80b0ab3..2ff8e66 100644 --- a/inertia/components/dashboard/link/link.module.css +++ b/inertia/components/dashboard/link/link.module.css @@ -2,7 +2,7 @@ user-select: none; cursor: pointer; width: 100%; - background-color: light-dark(--mantine-color-gray-1, rgb(50, 58, 71)); + background-color: light-dark(var(--mantine-color-gray-1), rgb(50, 58, 71)); padding: 0.75em 1em; border-radius: var(--border-radius); border: 1px solid transparent; diff --git a/inertia/mantine/components/dashboard/collection/item/collection_item.tsx b/inertia/mantine/components/dashboard/collection/item/collection_item.tsx index acac98c..c038c14 100644 --- a/inertia/mantine/components/dashboard/collection/item/collection_item.tsx +++ b/inertia/mantine/components/dashboard/collection/item/collection_item.tsx @@ -24,7 +24,8 @@ export default function CollectionItem({ } }, [collection.id, activeCollection?.id]); - const linksCount = activeCollection?.links.length ?? 0; + const linksCount = collection?.links.length ?? 0; + const showLinks = linksCount > 0; return ( - + {collection.name} - {linksCount > 0 && ( + {showLinks && ( — {linksCount} diff --git a/inertia/mantine/components/dashboard/dashboard_navbar.tsx b/inertia/mantine/components/dashboard/dashboard_navbar.tsx index 04cb286..4fae45e 100644 --- a/inertia/mantine/components/dashboard/dashboard_navbar.tsx +++ b/inertia/mantine/components/dashboard/dashboard_navbar.tsx @@ -6,9 +6,8 @@ import { Divider, Group, NavLink, + rem, ScrollArea, - Skeleton, - Stack, Text, } from '@mantine/core'; import { useTranslation } from 'react-i18next'; @@ -18,6 +17,7 @@ import { IoAdd, IoShieldHalfSharp } from 'react-icons/io5'; import { PiGearLight } from 'react-icons/pi'; import { MantineUserCard } from '~/components/common/mantine_user_card'; import useUser from '~/hooks/use_user'; +import { FavoriteList } from '~/mantine/components/dashboard/favorite/favorite_list'; interface DashboardNavbarProps { isOpen: boolean; @@ -32,7 +32,10 @@ export function DashboardNavbar({ isOpen, toggle }: DashboardNavbarProps) { active: true, styles: { label: { - fontSize: '16px', + fontSize: rem(16), + }, + root: { + borderRadius: rem(5), }, }, }; @@ -55,10 +58,10 @@ export function DashboardNavbar({ isOpen, toggle }: DashboardNavbarProps) { /> )} } - variant="subtle" - styles={common.styles} + color="var(--mantine-color-gray-7)" /> } /> } /> - - {t('favorite')} • {0} - - - {Array(15) - .fill(0) - .map((_, index) => ( - - ))} - + ); diff --git a/inertia/mantine/components/dashboard/favorite/favorite_list.module.css b/inertia/mantine/components/dashboard/favorite/favorite_list.module.css new file mode 100644 index 0000000..95c73cc --- /dev/null +++ b/inertia/mantine/components/dashboard/favorite/favorite_list.module.css @@ -0,0 +1,28 @@ +.sideMenu { + height: 100%; + width: 100%; + display: flex; + gap: 0.35em; + flex-direction: column; +} + +.listContainer { + height: 100%; + min-height: 0; + display: flex; + flex-direction: column; +} + +.collectionList { + padding: 1px; + padding-right: 5px; + display: flex; + flex: 1; + gap: 0.35em; + flex-direction: column; + overflow: auto; +} + +.noFavorite { + text-align: center; +} diff --git a/inertia/mantine/components/dashboard/favorite/favorite_list.tsx b/inertia/mantine/components/dashboard/favorite/favorite_list.tsx new file mode 100644 index 0000000..2f09d40 --- /dev/null +++ b/inertia/mantine/components/dashboard/favorite/favorite_list.tsx @@ -0,0 +1,39 @@ +import { Box, Group, ScrollArea, Stack, Text } from '@mantine/core'; +import { useTranslation } from 'react-i18next'; +import useFavorites from '~/hooks/use_favorites'; +import { FavoriteItem } from '~/mantine/components/dashboard/favorite/item/favorite_item'; +import styles from './favorite_list.module.css'; + +export function FavoriteList() { + const { t } = useTranslation('common'); + const { favorites } = useFavorites(); + + if (favorites.length === 0) { + return ( + + + {t('favorites-appears-here')} + + + ); + } + + return ( + + +
+ + {t('favorite')} • {favorites.length} + + + + {favorites.map((link) => ( + + ))} + + +
+
+
+ ); +} diff --git a/inertia/mantine/components/dashboard/favorite/item/favorite_item.module.css b/inertia/mantine/components/dashboard/favorite/item/favorite_item.module.css new file mode 100644 index 0000000..77dacdd --- /dev/null +++ b/inertia/mantine/components/dashboard/favorite/item/favorite_item.module.css @@ -0,0 +1,44 @@ +.linkWrapper { + user-select: none; + cursor: pointer; + width: 100%; + background-color: light-dark(var(--mantine-color-gray-1), rgb(50, 58, 71)); + padding: 0.25em 0.5em !important; + border-radius: var(--border-radius); + border: 1px solid transparent; +} + +.linkWrapper:hover { + border: 1px solid var(--mantine-color-blue-4); +} + +.linkName { + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; +} + +.linkDescription { + margin-top: 0.5em; + font-size: 0.8em; + word-wrap: break-word; +} + +.linkUrl { + width: 100%; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + font-size: 0.8em; + transition: opacity 0.3s; +} + +.linkWrapper:hover .linkUrlPathname { + opacity: 1; +} + +.linkUrlPathname { + opacity: 0; + transition: opacity 0.3s; +} diff --git a/inertia/mantine/components/dashboard/favorite/item/favorite_item.tsx b/inertia/mantine/components/dashboard/favorite/item/favorite_item.tsx new file mode 100644 index 0000000..e954546 --- /dev/null +++ b/inertia/mantine/components/dashboard/favorite/item/favorite_item.tsx @@ -0,0 +1,25 @@ +import { Card, Group, Text } from '@mantine/core'; // Import de Mantine +import { ExternalLinkStyled } from '~/components/common/external_link_styled'; +import LinkFavicon from '~/components/dashboard/link/link_favicon'; +import { LinkWithCollection } from '~/types/app'; +import styles from './favorite_item.module.css'; + +export const FavoriteItem = ({ + link: { name, url, collection }, +}: { + link: LinkWithCollection; +}) => ( + + + + +
+ {name} +
+ + {collection.name} + +
+
+
+);