({ user }: { user: SideMenuUser })
| 404 | } |
| 405 | |
| 406 | function UserMenu({ user }: { user: SideMenuUser }) { |
| 407 | const [isProfileMenuOpen, setProfileMenuOpen] = useState(false); |
| 408 | const navigation = useNavigation(); |
| 409 | const { v3Enabled } = useFeatures(); |
| 410 | |
| 411 | useEffect(() => { |
| 412 | setProfileMenuOpen(false); |
| 413 | }, [navigation.location?.pathname]); |
| 414 | |
| 415 | return ( |
| 416 | <Popover onOpenChange={(open) => setProfileMenuOpen(open)}> |
| 417 | <PopoverCustomTrigger isOpen={isProfileMenuOpen} className="p-1 hover:bg-transparent"> |
| 418 | <UserProfilePhoto |
| 419 | className={cn( |
| 420 | "h-5 w-5 rounded-full border border-transparent text-charcoal-600 transition hover:border-charcoal-600", |
| 421 | user.isImpersonating && "rounded-full border border-yellow-500" |
| 422 | )} |
| 423 | /> |
| 424 | </PopoverCustomTrigger> |
| 425 | <PopoverContent |
| 426 | className="min-w-[12rem] overflow-y-auto p-0 scrollbar-thin scrollbar-track-transparent scrollbar-thumb-charcoal-600" |
| 427 | align="start" |
| 428 | > |
| 429 | <Fragment> |
| 430 | <PopoverSectionHeader title={user.email} variant="extra-small" /> |
| 431 | <div className="flex flex-col gap-1 p-1"> |
| 432 | {user.isImpersonating && <ImpersonationBanner />} |
| 433 | {user.admin && ( |
| 434 | <PopoverMenuItem |
| 435 | to={"/admin"} |
| 436 | title="Admin" |
| 437 | icon={AcademicCapIcon} |
| 438 | leadingIconClassName="text-yellow-500" |
| 439 | /> |
| 440 | )} |
| 441 | <PopoverMenuItem |
| 442 | to={accountPath()} |
| 443 | title="View profile" |
| 444 | icon={UserProfilePhoto} |
| 445 | leadingIconClassName="text-indigo-500" |
| 446 | /> |
| 447 | {v3Enabled && ( |
| 448 | <PopoverMenuItem |
| 449 | to={personalAccessTokensPath()} |
| 450 | title="Personal Access Tokens" |
| 451 | icon={ShieldCheckIcon} |
| 452 | leadingIconClassName="text-emerald-500" |
| 453 | /> |
| 454 | )} |
| 455 | <PopoverMenuItem |
| 456 | to={logoutPath()} |
| 457 | title="Log out" |
| 458 | icon={ArrowRightOnRectangleIcon} |
| 459 | leadingIconClassName="text-rose-500" |
| 460 | /> |
| 461 | </div> |
| 462 | </Fragment> |
| 463 | </PopoverContent> |
nothing calls this directly
no test coverage detected
searching dependent graphs…