import type { MouseEvent, ReactNode } from 'react' import { Bookmark, CheckCheck, CheckCircle2, Loader2, Tag, Trash2, X } from 'lucide-react' import { fs } from '../shared/DialogShell' import { Tooltip } from '../shared/Tooltip' import type { SidebarState } from './usePlacesSidebar' /** An action on the dark selection bar: an icon named by its tooltip. */ function BarAction({ label, onClick, disabled = false, danger = false, children }: { label: string onClick: (e: MouseEvent) => void disabled?: boolean danger?: boolean children: ReactNode }) { return ( ) } /** * The bar that rises at the foot of the column while places are being picked: * how many, what to do with them, and the way out. Dark like a toast, so it * reads as the one thing in charge while the list is in this mode. */ export function PlacesSelectionBar(S: SidebarState) { const { t, selectedIds, filtered, setSelectedIds, isMobile, setPendingDeleteIds, onBulkDeletePlaces, setCategoryPickerOpen, collectionsEnabled, setSaveToListOpen, markSelectionVisited, markVisitedBusy, exitSelectMode } = S const none = selectedIds.size === 0 // An empty list keeps "Select all": 0 === 0 would otherwise read as everything selected. const allLabel = selectedIds.size === filtered.length && filtered.length > 0 ? t('common.deselectAll') : t('common.selectAll') return (
{/* Just the number, on a white badge: the words are its name and its tooltip. */} {selectedIds.size} { if (selectedIds.size === filtered.length) setSelectedIds(new Set()) else setSelectedIds(new Set(filtered.map(p => p.id))) }} > { if (none) return; setCategoryPickerOpen(true) }}> {collectionsEnabled && ( { if (none) return; setSaveToListOpen(true) }}> )} {collectionsEnabled && ( { if (none) return; void markSelectionVisited() }}> {markVisitedBusy ? : } )} { if (none) return if (isMobile) setPendingDeleteIds(Array.from(selectedIds)) else onBulkDeletePlaces?.(Array.from(selectedIds)) }} >
) }