'use client'; import Link from 'next/link'; import { CreditCard, Github, Key, LogOut, User as LucideUser, Monitor, Moon, Sun, UserCog, } from 'lucide-react'; import { signOut } from 'next-auth/react'; import { useTheme } from 'next-themes'; import { isAdmin } from '@documenso/lib/'; import { User } from '@documenso/prisma/client'; import { Avatar, AvatarFallback } from '@documenso/ui/primitives/avatar'; import { Button } from '@documenso/ui/primitives/button'; import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from '@documenso/ui/primitives/dropdown-menu'; import { useFeatureFlags } from '~/providers/feature-flag'; export type ProfileDropdownProps = { user: User; }; export const ProfileDropdown = ({ user }: ProfileDropdownProps) => { const { theme, setTheme } = useTheme(); const { getFlag } = useFeatureFlags(); const isUserAdmin = isAdmin(user); const isBillingEnabled = getFlag('app_billing'); const initials = user.name ?.split(' ') .map((name: string) => name.slice(0, 1).toUpperCase()) .slice(0, 2) .join('') ?? 'UK'; return ( Account Profile {isUserAdmin && ( Admin )} Password {isBillingEnabled && ( Billing )} {theme === 'light' ? null : ( setTheme('light')}> Light Mode )} {theme === 'dark' ? null : ( setTheme('dark')}> Dark Mode )} {theme === 'system' ? null : ( setTheme('system')}> System Theme )} Star on Github void signOut({ callbackUrl: '/', }) } > Sign Out ); };