import { Button } from "@/components/ui/button" import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu" import { Archive, ArchiveRestore, MoreVertical, Palette, Pin, Users, Maximize2, FileText, Trash2, RotateCcw, } from "lucide-react" import { cn } from "@/lib/utils" import { NOTE_COLORS } from "@/lib/types" import { useLanguage } from "@/lib/i18n" interface NoteActionsProps { isPinned: boolean isArchived: boolean currentColor: string currentSize?: 'small' | 'medium' | 'large' onTogglePin: () => void onToggleArchive: () => void onColorChange: (color: string) => void onSizeChange?: (size: 'small' | 'medium' | 'large') => void onDelete: () => void onShareCollaborators?: () => void isMarkdown?: boolean onToggleMarkdown?: () => void isTrashView?: boolean onRestore?: () => void onPermanentDelete?: () => void className?: string } export function NoteActions({ isPinned, isArchived, currentColor, currentSize = 'small', onTogglePin, onToggleArchive, onColorChange, onSizeChange, onDelete, onShareCollaborators, isMarkdown = false, onToggleMarkdown, isTrashView, onRestore, onPermanentDelete, className }: NoteActionsProps) { const { t } = useLanguage() // Trash view: show only Restore and Permanent Delete if (isTrashView) { return (
e.stopPropagation()} > {/* Restore Button */} {/* Permanent Delete Button */}
) } return (
e.stopPropagation()} > {/* Color Palette */}
{Object.entries(NOTE_COLORS).map(([colorName, classes]) => (
{/* Markdown Toggle */} {onToggleMarkdown && ( )} {/* More Options */} {/* Pin/Unpin Option */} {isPinned ? ( <> {t('notes.unpin')} ) : ( <> {t('notes.pin')} )} {isArchived ? ( <> {t('notes.unarchive')} ) : ( <> {t('notes.archive')} )} {/* Size Selector */} {onSizeChange && ( <>
{t('notes.size')}
{(['small', 'medium', 'large'] as const).map((size) => ( { onSizeChange?.(size); }} className={cn( "capitalize", currentSize === size && "bg-accent" )} > {t(`notes.${size}` as const)} ))} )} {/* Collaborators */} {onShareCollaborators && ( <> { e.stopPropagation() onShareCollaborators() }} > {t('notes.shareWithCollaborators')} )} {t('notes.delete')}
) }