import React from 'react' import { ContextMenu } from '../shared/ContextMenu' import FileImportModal from './FileImportModal' import ConfirmDialog from '../shared/ConfirmDialog' import { usePlacesSidebar, type PlacesSidebarProps } from './usePlacesSidebar' import { PlacesDropOverlay, PlacesHeader } from './PlacesSidebarHeader' import { PlacesSelectionBar } from './PlacesSidebarSelectionBar' import { PlacesList } from './PlacesSidebarList' import { MobileDayPickerSheet } from './PlacesSidebarMobileDayPicker' import { ListImportModal } from './PlacesSidebarListImportModal' import { PlacesBulkCategoryModal } from './PlacesBulkCategoryModal' import SaveTripPlacesToListModal from '../Collections/SaveTripPlacesToListModal' const PlacesSidebar = React.memo(function PlacesSidebar(props: PlacesSidebarProps) { const S = usePlacesSidebar(props) const { sidebarDragOver, handleSidebarDragEnter, handleSidebarDragOver, handleSidebarDragLeave, handleSidebarDrop, selectMode, filtered, t, dayPickerPlace, listImportOpen, fileImportOpen, setFileImportOpen, sidebarDropFile, setSidebarDropFile, tripId, pushUndo, ctxMenu, isMobile, pendingDeleteIds, setPendingDeleteIds, onBulkDeleteConfirm, categories, selectedIds, exitSelectMode, onBulkChangeCategory, categoryPickerOpen, setCategoryPickerOpen, collectionsEnabled, saveToListOpen, setSaveToListOpen, } = S // Below lg the places sit in their own tab with no plan beside them to drag // into. A coarse pointer no longer disables the drag on its own — tablets // reach it through a long press (#1616). const dragDisabled = isMobile return (
{!dragDisabled && sidebarDragOver && } {/* Kopfbereich */} {/* Anzahl / Auswahl-Leiste */} {selectMode ? ( ) : (
{/* A badge across the whole rail rather than a line of text hugging the left edge: it reads as the list's header instead of as a stray label. Outlined rather than filled, because the tertiary surface is a slate tone and put a blue cast on the panel. */}
{filtered.length === 1 ? t('places.countSingular') : t('places.count', { count: filtered.length })}
)} {/* Liste */} {dayPickerPlace && } {listImportOpen && } { setFileImportOpen(false); setSidebarDropFile(null) }} tripId={tripId} pushUndo={pushUndo} initialFile={sidebarDropFile} /> {categoryPickerOpen && ( setCategoryPickerOpen(false)} onPick={(catId) => { onBulkChangeCategory?.(Array.from(selectedIds), catId); setCategoryPickerOpen(false); exitSelectMode() }} /> )} {collectionsEnabled && ( setSaveToListOpen(false)} onDone={exitSelectMode} /> )} {isMobile && ( setPendingDeleteIds(null)} onConfirm={() => { onBulkDeleteConfirm?.(pendingDeleteIds!); setPendingDeleteIds(null) }} message={t('trip.confirm.deletePlaces', { count: pendingDeleteIds?.length ?? 0 })} /> )}
) }) export default PlacesSidebar