'use client';
import Link from 'next/link';
import { useState, useEffect } from 'react';
import {
Avatar,
AvatarFallback,
AvatarImage,
DropdownMenu,
DropdownMenuContent,
DropdownMenuItem,
DropdownMenuLabel,
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui';
import { useProfile, useAvatar } from '@/lib/hooks'
import { signOut } from '@/lib/actions';
import { User } from 'lucide-react';
const AvatarDropdown = () => {
const { profile } = useProfile();
const { avatarUrl, isLoading } = useAvatar(profile);
const handleSignOut = async () => {
await signOut();
};
if (isLoading) {
return (
);
}
return (
{avatarUrl ? (
) : (
{profile?.full_name
? profile.full_name.split(' ').map(n => n[0]).join('').toUpperCase()
: }
)}
{profile?.full_name}
Edit profile
);
};
export default AvatarDropdown;