import { MapPin } from 'lucide-react'; import React from 'react'; import type { Category, TranslationFn } from '../../types'; import { focusRevealedEditor } from '../shared/dialogFocus'; 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 (
{t('common.name')}
{categories.length > 0 && ( edit.set('categoryId', id)} size={36} t={t} /> )} edit.set('name', e.target.value)} aria-label={t('common.name')} className="col-detail-input min-w-0 flex-1" />
{t('places.formAddress')}
edit.set('address', e.target.value)} placeholder={t('places.formAddressPlaceholder')} className="col-detail-input" />
{t('collections.coordinates')}
edit.set('lat', v)} placeholder={t('places.formLat')} className="col-detail-input flex-1" /> edit.set('lng', v)} placeholder={t('places.formLng')} className="col-detail-input flex-1" />
{t('collections.description')}