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
@@ -0,0 +1,91 @@
import { MapPin } from 'lucide-react';
import React from 'react';
import type { Category, TranslationFn } from '../../types';
import { NumericInput } from '../shared/NumericInput';
import CategoryTileMenu from './CategoryTileMenu';
import type { PlaceEditState } from './usePlaceEdit';
/**
* The edit form of a place of All places in the desktop dialog: the name with
* its category, the address, the position and the description. The change is
* made on every copy of the place in the reader's lists and trips they may edit.
*/
export default function PlaceEditForm({
edit,
categories,
t,
}: {
edit: PlaceEditState;
categories: Category[];
t: TranslationFn;
}): React.ReactElement | null {
const { draft, target } = edit;
if (!draft || !target) return null;
return (
<div className="col-detail-edit">
<div className="col-detail-field">
<div className="col-detail-label">{t('common.name')}</div>
<div className="flex items-center gap-2.5">
{categories.length > 0 && (
<CategoryTileMenu
categories={categories}
value={draft.categoryId}
onChange={(id) => edit.set('categoryId', id)}
size={36}
t={t}
/>
)}
<input
autoFocus
value={draft.name}
onChange={(e) => edit.set('name', e.target.value)}
aria-label={t('common.name')}
className="col-detail-input min-w-0 flex-1"
/>
</div>
</div>
<div className="col-detail-field">
<div className="col-detail-label">
<MapPin size={12} /> {t('places.formAddress')}
</div>
<input
value={draft.address}
onChange={(e) => edit.set('address', e.target.value)}
placeholder={t('places.formAddressPlaceholder')}
className="col-detail-input"
/>
</div>
<div className="col-detail-field">
<div className="col-detail-label">
<MapPin size={12} /> {t('collections.coordinates')}
</div>
<div className="col-detail-link-row">
<NumericInput
mode="signed"
value={draft.lat}
onValueChange={(v) => edit.set('lat', v)}
placeholder={t('places.formLat')}
className="col-detail-input flex-1"
/>
<NumericInput
mode="signed"
value={draft.lng}
onValueChange={(v) => edit.set('lng', v)}
placeholder={t('places.formLng')}
className="col-detail-input flex-1"
/>
</div>
</div>
<div className="col-detail-field">
<div className="col-detail-label">{t('collections.description')}</div>
<textarea
value={draft.description}
onChange={(e) => edit.set('description', e.target.value)}
rows={5}
placeholder={t('collections.descriptionPlaceholder')}
className="col-detail-textarea"
/>
</div>
</div>
);
}