mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
feat: update user dropdown items
This commit is contained in:
@@ -2,8 +2,7 @@ import { Avatar, Group, Menu, Text, UnstyledButton } from '@mantine/core';
|
|||||||
import { useDisclosure } from '@mantine/hooks';
|
import { useDisclosure } from '@mantine/hooks';
|
||||||
import cx from 'clsx';
|
import cx from 'clsx';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { TbChevronDown, TbLogout, TbUser } from 'react-icons/tb';
|
import { TbChevronDown, TbLogout, TbShield } from 'react-icons/tb';
|
||||||
import { InternalLink } from '~/components/common/links/internal_link';
|
|
||||||
import { InternalLinkUnstyled } from '~/components/common/links/internal_link_unstyled';
|
import { InternalLinkUnstyled } from '~/components/common/links/internal_link_unstyled';
|
||||||
import { useAuth } from '~/hooks/use_auth';
|
import { useAuth } from '~/hooks/use_auth';
|
||||||
import classes from './user_dropdown.module.css';
|
import classes from './user_dropdown.module.css';
|
||||||
@@ -41,20 +40,17 @@ export function UserDropdown() {
|
|||||||
</UnstyledButton>
|
</UnstyledButton>
|
||||||
</Menu.Target>
|
</Menu.Target>
|
||||||
<Menu.Dropdown>
|
<Menu.Dropdown>
|
||||||
<Menu.Label>{t('common:user')}</Menu.Label>
|
|
||||||
<Menu.Item
|
|
||||||
leftSection={<TbUser size={16} />}
|
|
||||||
component={InternalLinkUnstyled}
|
|
||||||
href={`/user/${auth.user?.fullname}`}
|
|
||||||
color="inherit"
|
|
||||||
>
|
|
||||||
{t('common:profile')}
|
|
||||||
</Menu.Item>
|
|
||||||
|
|
||||||
{auth.user?.isAdmin && (
|
{auth.user?.isAdmin && (
|
||||||
<>
|
<>
|
||||||
<Menu.Label>{t('common:admin')}</Menu.Label>
|
<Menu.Label>{t('common:admin')}</Menu.Label>
|
||||||
<InternalLink href="/admin">{t('common:admin')}</InternalLink>
|
<Menu.Item
|
||||||
|
leftSection={<TbShield size={16} />}
|
||||||
|
component={InternalLinkUnstyled}
|
||||||
|
href="/admin"
|
||||||
|
color="red"
|
||||||
|
>
|
||||||
|
{t('common:manage_users')}
|
||||||
|
</Menu.Item>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@@ -63,7 +59,6 @@ export function UserDropdown() {
|
|||||||
leftSection={<TbLogout size={16} />}
|
leftSection={<TbLogout size={16} />}
|
||||||
component={InternalLinkUnstyled}
|
component={InternalLinkUnstyled}
|
||||||
href="/auth/logout"
|
href="/auth/logout"
|
||||||
color="inherit"
|
|
||||||
>
|
>
|
||||||
{t('common:logout')}
|
{t('common:logout')}
|
||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
|
|||||||
@@ -55,7 +55,8 @@
|
|||||||
"favorites-appears-here": "Your favorites will appear here",
|
"favorites-appears-here": "Your favorites will appear here",
|
||||||
"go-to-collection": "Go to collection",
|
"go-to-collection": "Go to collection",
|
||||||
"no-item-found": "No item found",
|
"no-item-found": "No item found",
|
||||||
"admin": "Administrator",
|
"admin": "Admin",
|
||||||
|
"manage_users": "Manage users",
|
||||||
"user": "User",
|
"user": "User",
|
||||||
"search": "Search",
|
"search": "Search",
|
||||||
"search-with": "Search with",
|
"search-with": "Search with",
|
||||||
|
|||||||
@@ -55,7 +55,8 @@
|
|||||||
"favorites-appears-here": "Vos favoris apparaîtront ici",
|
"favorites-appears-here": "Vos favoris apparaîtront ici",
|
||||||
"go-to-collection": "Voir la collection",
|
"go-to-collection": "Voir la collection",
|
||||||
"no-item-found": "Aucun élément trouvé",
|
"no-item-found": "Aucun élément trouvé",
|
||||||
"admin": "Administrateur",
|
"admin": "Admin",
|
||||||
|
"manage_users": "Gestion utilisateurs",
|
||||||
"user": "Utilisateur",
|
"user": "Utilisateur",
|
||||||
"search": "Rechercher",
|
"search": "Rechercher",
|
||||||
"search-with": "Rechercher avec",
|
"search-with": "Rechercher avec",
|
||||||
|
|||||||
Reference in New Issue
Block a user