import type { ReactNode } from 'react' import { Dropdown, DropdownOption } from '../elements/DropdownElements' import { LibraryItemNode } from '../../lib/networking/queries/useGetLibraryItemsQuery' import { UserBasicData } from '../../lib/networking/queries/useGetViewerQuery' export type CardMenuDropdownAction = | 'mark-read' | 'mark-unread' | 'archive' | 'unarchive' | 'delete' | 'set-labels' | 'open-notebook' | 'showOriginal' | 'unsubscribe' | 'editTitle' type CardMenuProps = { item: LibraryItemNode viewer: UserBasicData triggerElement: ReactNode actionHandler: (action: CardMenuDropdownAction) => void onOpenChange?: (open: boolean) => void } export function CardMenu(props: CardMenuProps): JSX.Element { return ( {!props.item.isArchived ? ( props.actionHandler('archive')} title="Archive" /> ) : ( props.actionHandler('unarchive')} title="Unarchive" /> )} { props.actionHandler('set-labels') }} title="Set labels" /> { props.actionHandler('open-notebook') }} title="Open notebook" /> props.actionHandler('showOriginal')} title="Open original" /> props.actionHandler('editTitle')} title="Edit info" /> {props.item.readingProgressPercent < 98 ? ( { props.actionHandler('mark-read') }} title="Mark read" /> ) : ( { props.actionHandler('mark-unread') }} title="Mark unread" /> )} { props.actionHandler('delete') }} title="Remove" /> {/* {!!props.item.subscription && ( { props.actionHandler('unsubscribe') }} title="Unsubscribe" /> )} */} ) }