'use client';

import Image from 'next/image';
import { useUser } from '../../lib/contexts';
import { Button } from '../ui';
import Link from 'next/link';

export function ProfileOrLogin() {
    const user = useUser();

    if (!user) {
        return <Button className="py-2.5 px-3.75">ВОЙТИ</Button>;
    }

    return (
        <Link href={'/profile'}>
            <Image
                src={user?.avatar ?? 'icons/avatar.svg'}
                alt=""
                width={60}
                height={60}
            />
        </Link>
    );
}
