fix(planner): offer trip places in manual transport

Signed-off-by: hiro-nikaitou <vieteviete@proton.me>
This commit is contained in:
hiro-nikaitou
2026-09-23 05:18:41 -04:00
committed by Maurice
parent 83d088e842
commit cc5957dc6a
2 changed files with 5 additions and 4 deletions
@@ -16,9 +16,10 @@ interface Props {
onChange: (loc: LocationPoint | null) => void onChange: (loc: LocationPoint | null) => void
placeholder?: string placeholder?: string
style?: React.CSSProperties style?: React.CSSProperties
places?: { name: string; lat: number; lng: number }[]
} }
export default function LocationSelect({ value, onChange, placeholder, style }: Props) { export default function LocationSelect({ value, onChange, placeholder, style, places }: Props) {
const { t, locale } = useTranslation() const { t, locale } = useTranslation()
// Ohne Reisekontext ist der Hinweis leer, und die Suche laeuft wie bisher. // Ohne Reisekontext ist der Hinweis leer, und die Suche laeuft wie bisher.
const { point: locationBias } = useLocationBias() const { point: locationBias } = useLocationBias()
@@ -46,7 +47,7 @@ export default function LocationSelect({ value, onChange, placeholder, style }:
if (debounceRef.current) clearTimeout(debounceRef.current) if (debounceRef.current) clearTimeout(debounceRef.current)
const trimmed = query.trim() const trimmed = query.trim()
if (trimmed.length < 3 || (value && trimmed === value.name)) { if (trimmed.length < 3 || (value && trimmed === value.name)) {
setResults([]) setResults(trimmed.length < 3 && places ? places : [])
return return
} }
debounceRef.current = setTimeout(async () => { debounceRef.current = setTimeout(async () => {
@@ -1009,11 +1009,11 @@ export function TransportModal({ isOpen, onClose, onSave, reservation, days, sel
<div className="grid grid-cols-1 sm:grid-cols-2 gap-3"> <div className="grid grid-cols-1 sm:grid-cols-2 gap-3">
<div> <div>
<label className={labelClass}>{t('reservations.meta.from')}</label> <label className={labelClass}>{t('reservations.meta.from')}</label>
<LocationSelect value={fromPick.location || null} onChange={l => setFromPick({ location: l || undefined })} /> <LocationSelect value={fromPick.location || null} onChange={l => setFromPick({ location: l || undefined })} places={places} />
</div> </div>
<div> <div>
<label className={labelClass}>{t('reservations.meta.to')}</label> <label className={labelClass}>{t('reservations.meta.to')}</label>
<LocationSelect value={toPick.location || null} onChange={l => setToPick({ location: l || undefined })} /> <LocationSelect value={toPick.location || null} onChange={l => setToPick({ location: l || undefined })} places={places} />
</div> </div>
</div> </div>