import {useAuth} from "Frontend/util/auth"; import {GearFine, Question, SignOut, User} from "@phosphor-icons/react"; import {Avatar, Dropdown, DropdownItem, DropdownMenu, DropdownTrigger} from "@nextui-org/react"; export default function ProfileMenu() { const {state, logout} = useAuth(); const profileMenuItems = [ { label: "My Profile", icon: , onClick: () => alert("Profile") }, { label: "Administration", icon: , onClick: () => alert("Administration"), showIf: state.user?.roles?.some(a => a?.includes("ADMIN")) }, { label: "Help", icon: , onClick: () => window.open("https://github.com/gameyfin/gameyfin/tree/v2", "_blank") }, { label: "Sign Out", icon: , onClick: () => logout(), color: "danger" }, ]; return ( {/* @ts-ignore */} {profileMenuItems.map(({label, icon, onClick, showIf, color}) => { return ( (showIf === undefined || showIf === true) ? {icon}} /* @ts-ignore */ color={color ? color : ""} className={`text-${color} hover:bg-primary/20`} > {label} : null ); })} ); }