(props: Props)
| 39 | ); |
| 40 | |
| 41 | export function UserMenu(props: Props) { |
| 42 | const billing = useBillingState(); |
| 43 | |
| 44 | return ( |
| 45 | <Menu as="div" className="relative"> |
| 46 | <Menu.Button className="flex w-full p-2 gap-2 items-center rounded text-sm focus-ring hover:bg-accent"> |
| 47 | {({ open }) => ( |
| 48 | <> |
| 49 | <UserAvatar user={props.user} /> |
| 50 | <div className="hidden lg:block">{props.user.name}</div> |
| 51 | {!open && billing === "OVERUSE" && <PingSignal color="warning" size="sm" />} |
| 52 | </> |
| 53 | )} |
| 54 | </Menu.Button> |
| 55 | <Transition |
| 56 | as={Fragment} |
| 57 | enter="transition ease-out duration-100" |
| 58 | enterFrom="transform opacity-0 scale-95" |
| 59 | enterTo="transform opacity-100 scale-100" |
| 60 | leave="transition ease-in duration-75" |
| 61 | leaveFrom="transform opacity-100 scale-100" |
| 62 | leaveTo="transform opacity-0 scale-95" |
| 63 | > |
| 64 | <Menu.Items className="absolute right-0 lg:bottom-8 lg:right-auto z-10 mt-2 w-60 origin-top-right rounded-md py-1 shadow-lg border bg-background focus-ring"> |
| 65 | <div className="px-3 py-1 text-xs flex items-center justify-between"> |
| 66 | <div> |
| 67 | <span className="text-muted-foreground">Signed in as</span> |
| 68 | <span className="block truncate text-sm font-medium">{props.user.email}</span> |
| 69 | </div> |
| 70 | <ThemeToggle /> |
| 71 | </div> |
| 72 | {isBillingEnabled && ( |
| 73 | <> |
| 74 | <Divider /> |
| 75 | <MenuItem href="/billing"> |
| 76 | <IconCreditCard className="w-4 h-4" /> |
| 77 | <span>Billing & Profile</span> |
| 78 | {billing === "OVERUSE" && <PingSignal color="warning" size="sm" />} |
| 79 | </MenuItem> |
| 80 | </> |
| 81 | )} |
| 82 | <Divider /> |
| 83 | <MenuItem href="#" onClick={signOut}> |
| 84 | <IconDoorExit className="w-4 h-4" /> |
| 85 | <span>Sign out</span> |
| 86 | </MenuItem> |
| 87 | </Menu.Items> |
| 88 | </Transition> |
| 89 | </Menu> |
| 90 | ); |
| 91 | } |
nothing calls this directly
no test coverage detected