chatbot-template/components/user-menu.tsx

25 lines
516 B
TypeScript
Raw Normal View History

2023-06-07 16:17:59 +04:00
'use client'
import * as React from 'react'
2023-06-07 16:17:59 +04:00
import { type Session } from '@auth/nextjs/types'
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 {
session?: Session
2023-06-07 16:17:59 +04:00
}
export function UserMenu({ session }: UserMenuProps) {
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
)
}
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-07 16:17:59 +04:00
}