import { memo } from 'react' import { Archive, ArrowCounterClockwise, Trash, X } from '@phosphor-icons/react' interface BulkActionBarProps { count: number isTrashView: boolean isArchivedView?: boolean onArchive: () => void onTrash: () => void onRestore: () => void onDeletePermanently: () => void onUnarchive?: () => void onClear: () => void } const actionBtnStyle = { padding: '5px 10px', borderRadius: 6, background: 'rgba(255,255,255,0.12)', color: 'inherit', fontSize: 12, fontWeight: 500 } as const const destructiveBtnStyle = { padding: '5px 10px', borderRadius: 6, background: 'rgba(224,62,62,0.2)', color: 'var(--destructive)', fontSize: 12, fontWeight: 500 } as const function renderTrashActions(onRestore: () => void, onArchive: () => void, onDeletePermanently: () => void) { return ( <> ) } function renderArchivedActions(onUnarchive: (() => void) | undefined, onTrash: () => void) { return ( <> ) } function renderDefaultActions(onArchive: () => void, onTrash: () => void) { return ( <> ) } function BulkActionBarInner({ count, isTrashView, isArchivedView, onArchive, onTrash, onRestore, onDeletePermanently, onUnarchive, onClear }: BulkActionBarProps) { return (
{count} selected
{isTrashView ? renderTrashActions(onRestore, onArchive, onDeletePermanently) : isArchivedView ? renderArchivedActions(onUnarchive, onTrash) : renderDefaultActions(onArchive, onTrash)}
) } export const BulkActionBar = memo(BulkActionBarInner)