mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-08 22:53:25 +00:00
25 lines
510 B
TypeScript
25 lines
510 B
TypeScript
import { Badge } from '@mantine/core';
|
|
import { useTranslation } from 'react-i18next';
|
|
import type { PublicUser, User } from '~/types/app';
|
|
|
|
interface UserBadgeRoleProps {
|
|
user: User | PublicUser;
|
|
}
|
|
|
|
export function UserBadgeRole({ user }: UserBadgeRoleProps) {
|
|
const { t } = useTranslation('common');
|
|
return (
|
|
<>
|
|
{user.isAdmin ? (
|
|
<Badge variant="light" color="red">
|
|
{t('admin')}
|
|
</Badge>
|
|
) : (
|
|
<Badge variant="light" color="green">
|
|
{t('user')}
|
|
</Badge>
|
|
)}
|
|
</>
|
|
);
|
|
}
|