diff --git a/client/scripts/size-baseline.json b/client/scripts/size-baseline.json
index 5b589778c..3d3878d81 100644
--- a/client/scripts/size-baseline.json
+++ b/client/scripts/size-baseline.json
@@ -7,7 +7,7 @@
"src/components/Budget/CostsPanel.tsx": 1607,
"src/components/Map/MapView.tsx": 1200,
"src/components/Map/MapViewGL.test.tsx": 2919,
- "src/components/Map/MapViewGL.tsx": 2118,
+ "src/components/Map/MapViewGL.tsx": 2116,
"src/components/Planner/DayDetailPanel.test.tsx": 2333,
"src/components/Planner/DayPlanSidebar.test.tsx": 5349,
"src/components/Planner/DayPlanSidebar.tsx": 2910,
diff --git a/client/src/components/Map/VectorBasemap.tsx b/client/src/components/Map/VectorBasemap.tsx
index 6100ebe74..ace778346 100644
--- a/client/src/components/Map/VectorBasemap.tsx
+++ b/client/src/components/Map/VectorBasemap.tsx
@@ -47,9 +47,47 @@ async function loadLayerFactory() {
import('./engines/maplibre'),
import('@maplibre/maplibre-gl-leaflet'),
])
+ guardTransitionEnd(bridge.MaplibreGL.prototype as unknown as GlLayerInternals)
return bridge.maplibreGL
}
+interface GlLayerInternals {
+ _map: L.Map | null
+ _glMap: { _actualCanvas: HTMLElement; once(event: string, fn: () => void): void; jumpTo(view: { center: L.LatLng; zoom: number }): void }
+ _resizeContainer(): void
+ _zoomEnd(): void
+ _transitionEnd: (e?: unknown) => void
+ _trekGuarded?: boolean
+}
+
+/**
+ * The bridge answers a map resize by scheduling a frame that reads
+ * `this._map.getZoom()` without asking whether the layer is still on a map. A
+ * layer taken off before that frame (a dialog closed at once, React mounting a
+ * map twice in development) threw "Cannot read properties of null (reading
+ * 'getZoom')" from inside the frame. This is the bridge's own method (0.1.4,
+ * pinned) with that question added; patched once, on the class.
+ */
+function guardTransitionEnd(proto: GlLayerInternals): void {
+ if (proto._trekGuarded) return
+ proto._transitionEnd = function (this: GlLayerInternals) {
+ L.Util.requestAnimFrame(() => {
+ const map = this._map
+ if (!map) return
+ const zoom = map.getZoom()
+ const center = map.getCenter()
+ const offset = map.latLngToContainerPoint(map.getBounds().getNorthWest())
+ this._resizeContainer()
+ L.DomUtil.setTransform(this._glMap._actualCanvas, offset, 1)
+ this._glMap.once('moveend', () => {
+ if (this._map) this._zoomEnd()
+ })
+ this._glMap.jumpTo({ center, zoom: zoom - 1 })
+ })
+ }
+ proto._trekGuarded = true
+}
+
/** The factory, or null when its chunk never arrived. A dead chunk is not the basemap's problem. */
async function loadLayerFactoryOrNull() {
try {
diff --git a/client/src/components/Map/flightAircraft.css b/client/src/components/Map/flightAircraft.css
index fbf9da2f3..71555a516 100644
--- a/client/src/components/Map/flightAircraft.css
+++ b/client/src/components/Map/flightAircraft.css
@@ -30,7 +30,7 @@
.trek-aircraft__halo {
position: absolute;
- left: 0;
+ inset-inline-start: 0;
top: 0;
width: 30px;
height: 30px;
@@ -53,7 +53,7 @@
.trek-aircraft__label {
position: absolute;
- left: 36px;
+ inset-inline-start: 36px;
top: 50%;
transform: translateY(-50%);
padding: 3px 8px;
diff --git a/client/src/components/Planner/bookings/BookingCard.tsx b/client/src/components/Planner/bookings/BookingCard.tsx
index ef91de68b..fc144fb86 100644
--- a/client/src/components/Planner/bookings/BookingCard.tsx
+++ b/client/src/components/Planner/bookings/BookingCard.tsx
@@ -72,7 +72,7 @@ export default function BookingCard(p: BookingCardProps) {
- {r.type === 'flight' && }
+
{transit ? : (
<>
diff --git a/client/src/components/Planner/bookings/BookingDetailDialog.tsx b/client/src/components/Planner/bookings/BookingDetailDialog.tsx
index 48c6c45e3..2a073f27b 100644
--- a/client/src/components/Planner/bookings/BookingDetailDialog.tsx
+++ b/client/src/components/Planner/bookings/BookingDetailDialog.tsx
@@ -146,11 +146,12 @@ export default function BookingDetailDialog(p: BookingDetailDialogProps) {
{!!r.needs_review && }
{r.confirmation_number && (
-
+ // The copy button rides in the pill's padding (-my-1), so this pill is as tall as its neighbours.
+ #{r.confirmation_number}
diff --git a/client/src/components/Planner/flightLive/FlightArc.tsx b/client/src/components/Planner/flightLive/FlightArc.tsx
deleted file mode 100644
index 02ed0b612..000000000
--- a/client/src/components/Planner/flightLive/FlightArc.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { useId } from 'react';
-
-interface FlightArcProps {
- /** Share of the way flown, 0 to 1. */
- progress: number;
- /** Draws the aircraft; off where only the route is shown. */
- showPlane: boolean;
- /** Softens the aircraft while its position is a guess (stale feed). */
- dimPlane?: boolean;
- /** Colours as CSS values, so the desktop and the phone dress it in their own tokens. */
- track: string;
- flown: string;
- plane: string;
- className?: string;
-}
-
-// The arc is a quadratic curve across a fixed box; the SVG scales to its column.
-const W = 320;
-const H = 74;
-const P0 = { x: 14, y: 62 };
-const P1 = { x: W / 2, y: -14 };
-const P2 = { x: W - 14, y: 62 };
-
-function pointAt(t: number): { x: number; y: number; angle: number } {
- const u = 1 - t;
- const x = u * u * P0.x + 2 * u * t * P1.x + t * t * P2.x;
- const y = u * u * P0.y + 2 * u * t * P1.y + t * t * P2.y;
- const dx = 2 * u * (P1.x - P0.x) + 2 * t * (P2.x - P1.x);
- const dy = 2 * u * (P1.y - P0.y) + 2 * t * (P2.y - P1.y);
- return { x, y, angle: (Math.atan2(dy, dx) * 180) / Math.PI };
-}
-
-const PATH = `M${P0.x} ${P0.y} Q${P1.x} ${P1.y} ${P2.x} ${P2.y}`;
-
-/** An airliner seen from above, nose along +x, about 18 units long. */
-const PLANE =
- 'M9 0c0-.9-.7-1.3-1.6-1.3H3.2L-1.6-7.6h-2.1l2.3 6.3h-4.1l-1.7-2.4h-1.6l1 3.7-1 3.7h1.6l1.7-2.4h4.1l-2.3 6.3h2.1l4.8-6.3h4.2C8.3 1.3 9 .9 9 0Z';
-
-/**
- * The route of a flight as a gentle arc: dashed where it is still to fly,
- * solid where it has flown, the aircraft riding the curve at its heading.
- * Around the aircraft the lines are masked out rather than covered, so it sits
- * cleanly on any card, translucent ones included. In a right-to-left layout
- * the origin stands on the right, so the whole drawing is mirrored with it.
- * Purely visual; the numbers sit in the card around it.
- */
-export default function FlightArc({
- progress,
- showPlane,
- dimPlane,
- track,
- flown,
- plane,
- className = '',
-}: FlightArcProps) {
- const maskId = useId();
- const p = Math.min(1, Math.max(0, progress));
- const at = pointAt(p);
- // A CSS transform rather than the attribute, so a new position glides there.
- const placed = { transform: `translate(${at.x}px, ${at.y}px) rotate(${at.angle}deg)` };
- return (
-
- );
-}
diff --git a/client/src/components/Planner/flightLive/FlightLiveCard.test.tsx b/client/src/components/Planner/flightLive/FlightLiveCard.test.tsx
index e1b5e2793..2aa8df1ae 100644
--- a/client/src/components/Planner/flightLive/FlightLiveCard.test.tsx
+++ b/client/src/components/Planner/flightLive/FlightLiveCard.test.tsx
@@ -1,16 +1,18 @@
-// FE-PLANNER-FLIGHTLIVE-001 to FE-PLANNER-FLIGHTLIVE-008
+// FE-PLANNER-FLIGHTLIVE-001 to FE-PLANNER-FLIGHTLIVE-007
import type { FlightLiveLeg } from '@trek/shared';
-import { beforeEach, describe, expect, it } from 'vitest';
+import { beforeEach, describe, expect, it, vi } from 'vitest';
import { render, screen } from '../../../../tests/helpers/render';
import MFlightLiveStrip, { MPlanFlightLine } from '../../../mobile/screens/trip/MFlightLiveStrip';
import MFlightLiveCard from '../../../mobile/screens/trip/sheets/MFlightLiveCard';
import { legKey, useFlightLiveStore } from '../../../store/flightLiveStore';
import type { Reservation } from '../../../types';
-import FlightArc from './FlightArc';
import FlightLiveCard from './FlightLiveCard';
import FlightLiveStrip, { PlanFlightLiveLine } from './FlightLiveStrip';
+// The map is Leaflet and WebGL, neither of which jsdom draws; the card around it is what is under test here.
+vi.mock('./FlightMiniMap', () => ({ default: () => null, FLIGHT_MAP_CREDIT: 'map credit' }));
+
const H = 3_600_000;
function leg(over: Partial = {}): FlightLiveLeg {
@@ -76,7 +78,6 @@ describe('FlightLiveCard', () => {
expect(screen.getByText('+35 min')).toBeInTheDocument();
expect(screen.getByText('Altitude')).toBeInTheDocument();
expect(screen.getByText('A359 D-AIXA')).toBeInTheDocument();
- expect(screen.getByText('Live positions: adsb.lol (ODbL)')).toBeInTheDocument();
});
it('FE-PLANNER-FLIGHTLIVE-002: renders nothing while TREK follows no state for the leg', () => {
@@ -106,7 +107,7 @@ describe('FlightLiveCard', () => {
expect(screen.queryByText('Altitude')).not.toBeInTheDocument();
});
- it('FE-PLANNER-FLIGHTLIVE-004: explains a flight the feed cannot find, and the missing gate only around boarding', () => {
+ it('FE-PLANNER-FLIGHTLIVE-004: shows nothing without live data, and the missing gate only around boarding', () => {
seed(
leg({
phase: 'unknown',
@@ -117,11 +118,8 @@ describe('FlightLiveCard', () => {
last_seen_at: null,
})
);
- const { unmount } = render();
- expect(screen.getByText('No live data')).toBeInTheDocument();
- expect(screen.queryByText(/Gate, terminal and baggage belt/)).not.toBeInTheDocument();
- // Nothing heard, so the feed is not credited either.
- expect(screen.queryByText('Live positions: adsb.lol (ODbL)')).not.toBeInTheDocument();
+ const { container, unmount } = render();
+ expect(container).toBeEmptyDOMElement();
unmount();
const now = Date.now();
seed(
@@ -156,7 +154,7 @@ describe('strips and plan lines', () => {
seed(leg());
render(
<>
-
+ {}} />
>
);
@@ -179,7 +177,7 @@ describe('strips and plan lines', () => {
const res = { id: 6, type: 'flight' } as Reservation;
const { container } = render(
<>
-
+
@@ -188,14 +186,3 @@ describe('strips and plan lines', () => {
expect(container).toBeEmptyDOMElement();
});
});
-
-describe('FlightArc', () => {
- it('FE-PLANNER-FLIGHTLIVE-008: draws the flown part only once under way, and the aircraft on request', () => {
- const { container, rerender } = render(
-
- );
- expect(container.querySelectorAll('path')).toHaveLength(1);
- rerender();
- expect(container.querySelectorAll('path')).toHaveLength(3);
- });
-});
diff --git a/client/src/components/Planner/flightLive/FlightLiveCard.tsx b/client/src/components/Planner/flightLive/FlightLiveCard.tsx
index f105dbebc..3ae0d0cfd 100644
--- a/client/src/components/Planner/flightLive/FlightLiveCard.tsx
+++ b/client/src/components/Planner/flightLive/FlightLiveCard.tsx
@@ -1,142 +1,167 @@
-import { Info, Radio } from 'lucide-react';
+import { Clock, Info } from 'lucide-react';
import { useTranslation } from '../../../i18n';
import type { DelayTone } from '../../../utils/flightLiveModel';
-import FlightArc from './FlightArc';
+import { Field } from '../bookings/bookingParts';
+import FlightMiniMap, { FLIGHT_MAP_CREDIT } from './FlightMiniMap';
import { useFlightLiveCard, type FlightTimeCell } from './useFlightLiveCard';
-const DELAY_CHIP: Record = {
- ok: 'bg-success-soft text-success',
- minor: 'bg-warning-soft text-warning',
- major: 'bg-danger-soft text-danger',
+type CardTone = 'live' | 'done' | 'planned';
+
+/** The dialog head's pill, one size down: this head sits inside the dialog, under the real one. */
+const PILL =
+ 'inline-flex flex-none items-center gap-1 rounded-full bg-surface-card px-2 py-0.5 text-caption font-semibold text-content shadow-sm';
+
+const DELAY_TONE: Record = {
+ ok: 'text-success',
+ minor: 'text-warning',
+ major: 'text-danger',
+};
+
+/** The head band's tint and the status dot, in the stage's colour like a booking dialog's head. */
+const HEAD: Record = {
+ live: { band: 'bg-[color-mix(in_srgb,var(--info)_11%,transparent)]', dot: 'bg-info' },
+ done: { band: 'bg-[color-mix(in_srgb,var(--success)_11%,transparent)]', dot: 'bg-success' },
+ planned: { band: 'bg-surface-tertiary', dot: 'bg-content-faint' },
};
interface FlightLiveCardProps {
tripId: number;
reservationId: number;
legIndex: number;
- /** "Flight 2 of 3" above the card, for a booking with stopovers. */
+ /** "Flight 2 of 3" in the head, for a booking with stopovers. */
legLabel?: string;
}
-function TimeBlock({
+/** The time that counts on a white tile, the planned one struck beside it; both ends' tiles are the same size. */
+function TimeTile({ cell, end }: { cell: FlightTimeCell; end?: boolean }) {
+ return (
+
+ {cell.planned && {cell.planned}}
+ {cell.value}
+
+ );
+}
+
+/** One end of the pass: its label, the airport code large, the city, and its time at the foot. */
+function End({
+ label,
code,
city,
cell,
end,
}: {
+ label: string;
code: string;
city: string | null;
cell: FlightTimeCell;
end?: boolean;
}) {
return (
-
);
}
/**
- * A flight's live state in the booking dialog: what is happening now in one
- * line, both airports with their times, the route as an arc with the aircraft
- * on it, and the numbers of the moment. Renders nothing while TREK follows no
- * state for this leg, so the dialog keeps its plain schedule tiles.
+ * A flight's live state in the booking dialog, built from the dialog's own
+ * parts: a tinted head with pills (where the flight stands, what comes next,
+ * the delay) like the dialog's head; the pass with a small real map of the
+ * route behind it and both times on tiles; then the numbers of the moment as
+ * the dialog's fields. Renders nothing while TREK has no live state to show
+ * for this leg, so the dialog keeps its plain schedule tiles.
*/
export default function FlightLiveCard({ tripId, reservationId, legIndex, legLabel }: FlightLiveCardProps) {
const { t } = useTranslation();
const card = useFlightLiveCard(tripId, reservationId, legIndex);
if (!card) return null;
const { leg, view } = card;
- const quiet = view.stage === 'past' || view.stage === 'unknown';
+ const head = HEAD[card.tone];
return (
- {legLabel && (
-