2023-06-07 16:17:59 +04:00
|
|
|
'use client'
|
|
|
|
|
|
2023-06-11 00:23:23 +04:00
|
|
|
import * as React from 'react'
|
2023-06-07 16:17:59 +04:00
|
|
|
import { type Session } from '@auth/nextjs/types'
|
2023-06-11 00:23:23 +04:00
|
|
|
|
2023-06-13 18:14:06 +04:00
|
|
|
import { LoginButton } from '@/components/login-button'
|
2023-06-07 16:17:59 +04:00
|
|
|
|
|
|
|
|
export interface UserMenuProps {
|
2023-06-11 00:23:23 +04:00
|
|
|
session?: Session
|
2023-06-07 16:17:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function UserMenu({ session }: UserMenuProps) {
|
2023-06-11 00:23:23 +04:00
|
|
|
if (!session?.user) {
|
2023-06-07 16:17:59 +04:00
|
|
|
return (
|
2023-06-13 18:14:06 +04:00
|
|
|
<LoginButton variant="ghost" className="[&_svg]:hidden" text="Login" />
|
2023-06-07 16:17:59 +04:00
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-11 15:08:59 +04:00
|
|
|
return (
|
2023-06-13 18:14:06 +04:00
|
|
|
<p className="px-2 text-sm font-medium truncate w-[100px] sm:w-auto">
|
|
|
|
|
{session.user.name}
|
|
|
|
|
</p>
|
2023-06-11 15:08:59 +04:00
|
|
|
)
|
2023-06-07 16:17:59 +04:00
|
|
|
}
|