diff options
| author | 2026-02-28 09:03:19 +0800 | |
|---|---|---|
| committer | 2026-02-28 09:03:19 +0800 | |
| commit | cc53b1cf260e1c67939e50608ef18764da616d55 (patch) | |
| tree | 119109c62331d4d26612e2df7726cee82d1871f5 /packages/ui/src/components/user-avatar.tsx | |
| parent | ee37d044e473217daadd9ce26c7e2e2ad39a0490 (diff) | |
| parent | 81a62402ef6f8900ff092366121a9b7a4263ba52 (diff) | |
| download | DropOut-cc53b1cf260e1c67939e50608ef18764da616d55.tar.gz DropOut-cc53b1cf260e1c67939e50608ef18764da616d55.zip | |
Merge remote-tracking branch 'upstream/main'
Diffstat (limited to 'packages/ui/src/components/user-avatar.tsx')
| -rw-r--r-- | packages/ui/src/components/user-avatar.tsx | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/packages/ui/src/components/user-avatar.tsx b/packages/ui/src/components/user-avatar.tsx new file mode 100644 index 0000000..bbdb84c --- /dev/null +++ b/packages/ui/src/components/user-avatar.tsx @@ -0,0 +1,23 @@ +import { useAuthStore } from "@/models/auth"; +import { Avatar, AvatarBadge, AvatarFallback, AvatarImage } from "./ui/avatar"; + +export function UserAvatar({ + className, + ...props +}: React.ComponentProps<typeof Avatar>) { + const authStore = useAuthStore(); + + if (!authStore.account) { + return null; + } + + return ( + <Avatar {...props}> + <AvatarImage + src={`https://minotar.net/helm/${authStore.account.username}/100.png`} + /> + <AvatarFallback>{authStore.account.username.slice(0, 2)}</AvatarFallback> + <AvatarBadge /> + </Avatar> + ); +} |