import { KebabHorizontalIcon } from '@primer/octicons-react' import { ReactNode, useState } from 'react' import MenuComponent from '~/components/Menu' import { Machine, Route, User } from '~/types' import { cn } from '~/utils/cn' import Delete from './dialogs/delete' import Expire from './dialogs/expire' import Move from './dialogs/move' import Rename from './dialogs/rename' import Routes from './dialogs/routes' import Tags from './dialogs/tags' interface MenuProps { machine: Machine routes: Route[] users: User[] magic?: string buttonChild?: ReactNode } export default function Menu({ machine, routes, magic, users, buttonChild }: MenuProps) { const renameState = useState(false) const expireState = useState(false) const removeState = useState(false) const routesState = useState(false) const moveState = useState(false) const tagsState = useState(false) const expired = machine.expiry === '0001-01-01 00:00:00' || machine.expiry === '0001-01-01T00:00:00Z' || machine.expiry === null ? false : new Date(machine.expiry).getTime() < Date.now() return ( <> {expired ? undefined : ( )} {buttonChild ?? ( )} Edit machine name Edit route settings Edit ACL tags Change owner {expired ? undefined : ( Expire )} Remove ) }