import { ReactNode, useMemo, useState } from 'react' import { HStack, VStack } from './../elements/LayoutPrimitives' import { Dropdown, DropdownOption } from '../elements/DropdownElements' import { StyledText } from '../elements/StyledText' import { Button } from '../elements/Button' import { currentThemeName } from '../../lib/themeUpdater' import { Check } from 'phosphor-react' export type HeaderDropdownAction = | 'apply-dark-theme' | 'apply-light-theme' | 'navigate-to-install' | 'navigate-to-emails' | 'navigate-to-labels' | 'navigate-to-profile' | 'navigate-to-subscriptions' | 'navigate-to-api' | 'navigate-to-integrations' | 'increaseFontSize' | 'decreaseFontSize' | 'logout' type DropdownMenuProps = { username?: string triggerElement: ReactNode actionHandler: (action: HeaderDropdownAction) => void } export function DropdownMenu(props: DropdownMenuProps): JSX.Element { const [currentTheme, setCurrentTheme] = useState(currentThemeName()) const isDark = useMemo(() => { return currentTheme === 'Dark' || currentTheme === 'Darker' }, [currentTheme]) return ( Theme props.actionHandler('navigate-to-install')} title="Install" /> props.actionHandler('navigate-to-emails')} title="Emails" /> props.actionHandler('navigate-to-labels')} title="Labels" /> props.actionHandler('navigate-to-api')} title="API Keys" /> props.actionHandler('navigate-to-integrations')} title="Integrations" /> window.open('https://docs.omnivore.app', '_blank')} title="Documentation" /> window.Intercom('show')} title="Feedback" /> props.actionHandler('logout')} title="Logout" /> ) }