diff --git a/src/components/layout/header/AvatarMenu.tsx b/src/components/layout/header/AvatarMenu.tsx
index e0ea38d01..f9d6b4d0d 100644
--- a/src/components/layout/header/AvatarMenu.tsx
+++ b/src/components/layout/header/AvatarMenu.tsx
@@ -8,6 +8,7 @@ import {
IconSun,
IconUserCog,
} from '@tabler/icons-react';
+import { createHash } from 'crypto';
import { User } from 'next-auth';
import { signOut, useSession } from 'next-auth/react';
import { useTranslation } from 'next-i18next';
@@ -26,66 +27,64 @@ export const AvatarMenu = () => {
const defaultBoardHref = useBoardLink('/board');
return (
- <>
-
-
+
);
};
@@ -93,12 +92,29 @@ type CurrentUserAvatarProps = {
user: User | null;
};
+const getGravatar = (email?: string | undefined | null) => {
+ if (!email) return null;
+ const emailHash = createHash('sha256').update(email.trim().toLowerCase()).digest('hex');
+ return `https://gravatar.com/avatar/${emailHash}?d=null`;
+};
+
const CurrentUserAvatar = forwardRef(
({ user, ...others }, ref) => {
const { primaryColor } = useMantineTheme();
- if (!user) return ;
+ const { fn } = useMantineTheme();
+ const border = fn.variant({ variant: 'default' }).border;
+
+ if (!user)
+ return ;
+
return (
-
+
{user.name?.slice(0, 2).toUpperCase()}
);