'use client' import { useUser } from 'common' import { Avatar, AvatarFallback, AvatarImage } from '@/registry/default/components/ui/avatar' const CurrentUserAvatarDemo = () => { // this demo only works on supabase.com because all apps are on the same domain and share cookies const user = useUser() const profileImage = user?.user_metadata.avatar_url ?? null const name = (user?.user_metadata.full_name as string) ?? '?' const initials = name ?.split(' ') ?.map((word) => word[0]) ?.join('') ?.toUpperCase() return (
{profileImage && } {initials} {!user && ( It seems like you're not logged in. Login via the{' '} Dashboard {' '} to see your avatar. )}
) } export default CurrentUserAvatarDemo