feat(places): one place view for All places and the lists

The desktop dialog and the phone sheet of a place show its overview, notes,
tours and bookings, photos and files and its history in tabs, with the tags
of each list and trip, a markdown notes editor, uploads and the place
picture. The rating bar of All places is the rating row the lists show,
with its voters, and votes once for every copy. All places filters by a
lowest rating and sorts by it, and the edit form changes the first copy the
reader may edit, which the server carries to the others.
This commit is contained in:
Maurice
2026-11-29 23:36:43 +00:00
parent 783c98f41e
commit d758f4c592
78 changed files with 5604 additions and 2797 deletions
+3 -5
View File
@@ -16,7 +16,6 @@ import AddPlaceToCollectionModal from '../components/Collections/AddPlaceToColle
import ImportFromTripModal from '../components/Collections/ImportFromTripModal'
import ImportCollectionModal from '../components/Collections/ImportCollectionModal'
import CollectionPlaceDetail from '../components/Collections/CollectionPlaceDetail'
import { detailDock } from '../components/Collections/detailDock'
import PlacesLibraryView from '../components/Collections/PlacesLibraryView'
import LabelManager from '../components/Collections/LabelManager'
import BulkAssignLabelModal from '../components/Collections/BulkAssignLabelModal'
@@ -82,9 +81,6 @@ function CollectionsPageDesktop(): React.ReactElement {
const onMapSelect = (id: number) => showPlace(id)
const desktopSplit = c.isWide && c.hasMappable
// Where the place detail docks: over the list in the split, on the map's start
// edge when the map has the whole width, and as a centred sheet otherwise.
const dock = detailDock(desktopSplit, c.view, c.mapColRect, c.listColRect)
const mapShown = c.hasMappable && (c.view === 'map' || c.isWide)
const mapOverlay = c.isWide && mapShown // the map carries the toggle + search
const canAddPlace = typeof c.activeId === 'number' && c.canEdit // a real list you can edit
@@ -249,6 +245,7 @@ function CollectionsPageDesktop(): React.ReactElement {
eyebrow={t('collections.library.eyebrow')}
title={t('collections.library.title')}
color={heroColor}
variant="library"
description={t('collections.library.subtitle')}
members={[]}
canShare={false}
@@ -295,6 +292,7 @@ function CollectionsPageDesktop(): React.ReactElement {
title={title}
color={heroColor}
coverImage={heroCover}
variant={c.isAllSaved ? 'saved' : undefined}
description={c.isAllSaved ? t('collections.allSavedSubtitle') : (c.activeCollection?.description ?? null)}
links={c.isAllSaved ? undefined : c.activeCollection?.links}
members={c.members}
@@ -403,7 +401,7 @@ function CollectionsPageDesktop(): React.ReactElement {
canDelete={c.canDelete}
categories={c.categories}
labels={c.labels}
anchorRect={dock}
blocked={c.copyIds != null}
onClose={c.handleCloseDetail}
onSetStatus={c.handleDetailStatus}
onSave={patch => c.updatePlace(c.selectedPlace!.id, patch)}
@@ -11,7 +11,7 @@ import { collectionsApi } from '../../api/collections'
import { downloadCollectionFile, downloadCollectionGpx, downloadCollectionKml, type CollectionExportFormat } from '../../components/Collections/collectionFile'
import { getApiErrorMessage } from '../../types'
import { PLACES_SAVED, placesPath } from '../../utils/placesRoutes'
import type { CopyCarry, CopyCarryOptions } from '../../components/Collections/useTripCopyPicker'
import { carryKey, type CopyCarry, type CopyCarryOptions } from '../../components/Collections/useTripCopyPicker'
import { canAddToCollection, canRemoveFromCollection, collectionRoleOf } from '../../utils/collectionAccess'
import { addListener, removeListener } from '../../api/websocket'
import { useCollectionStore, ALL_SAVED } from '../../store/collectionStore'
@@ -570,10 +570,13 @@ export function useCollections() {
// What the places about to be copied carry, so the picker can offer to take it along.
const copyCarryOptions = useMemo<CopyCarryOptions>(() => {
const picked = places.filter(p => (copyIds ?? []).includes(p.id))
const tags = new Map<number, CopyCarryOptions['tags'][number]>()
for (const p of picked) for (const tag of p.tags ?? []) if (tag.id != null && tag.name) tags.set(tag.id, { id: tag.id, name: tag.name, color: tag.color })
// The list's tags first, then older tags kept on the places; one entry per name.
const tags = new Map<string, CopyCarryOptions['tags'][number]>()
const add = (key: string, name: string, color?: string | null) => { if (!tags.has(name.toLowerCase())) tags.set(name.toLowerCase(), { key, name, color }) }
for (const p of picked) for (const id of p.label_ids ?? []) { const l = labels.find(x => x.id === id); if (l) add(carryKey('label', l.id), l.name, l.color) }
for (const p of picked) for (const tag of p.tags ?? []) if (tag.id != null && tag.name) add(carryKey('tag', tag.id), tag.name, tag.color)
return { hasNotes: picked.some(p => !!p.notes?.trim()), tags: [...tags.values()] }
}, [places, copyIds])
}, [places, copyIds, labels])
const handleCopyToTrip = useCallback(async (tripId: number, carry: CopyCarry = {}) => {
const ids = copyIds ?? []