blob: 68c81f6d0a2580ba129ca45e280ba938dbdfffa0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
'use client';
import Image from 'next/image';
import { useUser } from '../../lib/contexts';
import { Button } from '../ui';
import Link from 'next/link';
import { Dialog, DialogTrigger } from '../ui/dialog';
import { AuthDialog } from './AuthDialog';
export function ProfileOrLogin() {
const user = useUser();
if (!user) {
return (
<Dialog>
<DialogTrigger asChild>
<Button className="py-2.5 px-3.75 gap-10 w-21.75 h-10.5">
ВОЙТИ
</Button>
</DialogTrigger>
<AuthDialog />
</Dialog>
);
}
const profileLink = `/profile/${user.username}`;
return (
<Link href={profileLink}>
<Image
src={user?.avatar ?? '/icons/avatar.svg'}
alt=""
width={60}
height={60}
/>
</Link>
);
}
|