Rework entry types: merge hotel into stay, transport with modes, auto-transport

- Type set is now activity/stay/transport/flight/rental/note; hotel, travel
  and immigration are removed with idempotent startup data migrations
  (hotel->stay, travel->transport, immigration->activity with flag prefix)
- Transport entries carry an optional mode (train/bus/ferry/taxi/drive/other)
  that drives the chip/map icon; route stops expose transport_mode
- Creating a stay auto-creates a bridging transport to its neighbouring
  stays unless a transport/flight already covers the gap (one-shot)
- Summary: transports count replaces hotels/travelLegs
This commit is contained in:
2026-07-19 17:47:21 +07:00
parent b066e7b885
commit d393e16ae1
17 changed files with 469 additions and 62 deletions
+3 -4
View File
@@ -1,5 +1,5 @@
// Summary panel built from the /route response's `summary` block:
// days, nights, flights, hotels, travel legs, activities, total km, and the
// days, nights, flights, transports, activities, total km, and the
// list of locations in visit order.
import { el } from '../dom.js';
import { stayColor } from './stayBands.js';
@@ -7,7 +7,7 @@ import { stayColor } from './stayBands.js';
export function renderSummary(tctx) {
const route = tctx.route || {};
const s = route.summary || {
days: 0, nights: 0, flights: 0, flightSegments: 0, hotels: 0, travelLegs: 0, activities: 0, locations: [],
days: 0, nights: 0, flights: 0, flightSegments: 0, transports: 0, activities: 0, locations: [],
};
const totalKm = route.totalKm || 0;
// Show the leg count under the Flights tile only when a flight has segments.
@@ -31,9 +31,8 @@ export function renderSummary(tctx) {
tile('🗓️', s.days, s.days === 1 ? 'Day' : 'Days'),
tile('🌙', s.nights, s.nights === 1 ? 'Night' : 'Nights'),
tile('✈️', s.flights, 'Flights', flightSub),
tile('🏨', s.hotels, 'Hotels'),
tile('🚗', s.travelLegs, 'Travel legs'),
tile('📍', s.activities, 'Activities'),
s.transports > 0 ? tile('🚆', s.transports, s.transports === 1 ? 'Transport' : 'Transports') : null,
s.rentals > 0 ? tile('🚙', s.rentals, s.rentals === 1 ? 'Rental' : 'Rentals') : null,
s.stays > 0 ? tile('🏙️', s.stays, s.stays === 1 ? 'Stay' : 'Stays') : null,
);