mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-14 08:11:03 +00:00
fix(bookings): show where an imported stay lands on the map before it is saved
An imported hotel was looked up once, by its name and its address together. A booking site's romanized address (Agoda for a stay in Japan) often matches nothing and sank the hotel's name with it, so the place was created without coordinates and silently never showed on the map. The review now finds the stay right away (name and address, then the name, then the address) and says under the address whether it is on the map and where, or that it is not yet, with a way to search again. Picking an address suggestion sets the spot by hand. The save uses that spot, falls back the same way when there is none, and a stay saved without a spot says so in a toast. Desktop dialog and phone sheet share the lookup through useReservationForm.
This commit is contained in:
@@ -287,6 +287,8 @@ export interface ReservationSaveOptions {
|
||||
isEdit: boolean;
|
||||
/** The desktop also saves the end of the check-in window. */
|
||||
withCheckInEnd: boolean;
|
||||
/** Where the review found an imported stay on the map, so the save creates its place right there. */
|
||||
venuePin?: { lat: number; lng: number } | null;
|
||||
}
|
||||
|
||||
export type ReservationSaveData = Record<string, unknown> & { title: string };
|
||||
@@ -344,7 +346,11 @@ export function reservationSaveData(
|
||||
// import): the save handler geocodes it and creates the place.
|
||||
venue:
|
||||
!form.hotel_place_id && (form.hotel_address || form.title)
|
||||
? { name: form.title, address: form.hotel_address || null }
|
||||
? {
|
||||
name: form.title,
|
||||
address: form.hotel_address || null,
|
||||
...(opts.venuePin ? { lat: opts.venuePin.lat, lng: opts.venuePin.lng } : {}),
|
||||
}
|
||||
: null,
|
||||
// The typed address, so the save handler can write it through to a linked
|
||||
// place; an edited address used to be silently dropped (#1496).
|
||||
|
||||
Reference in New Issue
Block a user