fix(ci): green the dev gates after the native and popup rounds

- RTL: the measured pills and centred controls use logical forms or a marked line
- i18n: the two native widget numbers are positions, not counts (NOT_PLURAL)
- Types: styleOverride on the lazy GL map, the location and shared-file payloads,
  the capabilities fallback, the transport sheet's stay metadata
- ESLint: latest-value refs move to layout effects, usePresence keeps the last
  open state in state, the booking import opens clean with a shared document
  kept in the list (the reset effect used to clear it again)
- Layers: the phone import sheet lives under mobile/ and reads through tripRepo;
  the offline host check moves to utils/tileUrl
- Sizes: plugin layer geometry, hardNavigate and the exit animations get
  modules of their own
- Tests follow the status radios, the stay chip overview, the dock + button
  for the first list and the field token; store registry lists the new stores
This commit is contained in:
Maurice
2026-11-06 18:24:25 +01:00
parent f81fe8cb17
commit b7951baf23
75 changed files with 645 additions and 475 deletions
+4 -1
View File
@@ -70,7 +70,10 @@ export function nativeCapabilities(): NativeCapabilities {
*/
export async function checkAppUpdate(fetchFeatures: () => Promise<{ minNativeShellApi?: unknown }>): Promise<boolean> {
if (!isNativeApp()) return false;
const [caps, features] = await Promise.all([loadNativeCapabilities(), fetchFeatures().catch(() => ({}))]);
const [caps, features] = await Promise.all([
loadNativeCapabilities(),
fetchFeatures().catch((): { minNativeShellApi?: unknown } => ({})),
]);
const min = typeof features.minNativeShellApi === 'number' ? features.minNativeShellApi : 0;
updateRequired = caps.shellApi < min;
emit();
+1 -1
View File
@@ -23,7 +23,7 @@ beforeEach(() => {
vi.mocked(TrekShell.addListener)
.mockReset()
.mockImplementation(async (_event, listener) => {
emit = listener;
emit = listener as unknown as typeof emit;
return { remove: async () => {} };
});
});
+1 -1
View File
@@ -57,7 +57,7 @@ function toError(e: { code: number; message: string }): GeolocationPositionError
function dispatch(payload: NativeLocationPayload): void {
for (const [id, w] of [...watchers]) {
if (payload.error) w.failure?.(toError(payload.error));
else w.success(toPosition(payload));
else w.success(toPosition(payload as Extract<NativeLocationPayload, { latitude: number }>));
if (w.once) watchers.delete(id);
}
syncStream();
+1 -1
View File
@@ -30,7 +30,7 @@ describe('shared booking documents', () => {
await startSharedFiles();
expect(useSharedImportStore.getState().file?.name).toBe('booking.pdf');
const listener = vi.mocked(TrekShell.addListener).mock.calls[0][1] as (p: typeof PDF) => void;
const listener = vi.mocked(TrekShell.addListener).mock.calls[0][1] as unknown as (p: typeof PDF) => void;
listener({ ...PDF, name: 'train.ics', mimeType: 'text/calendar' });
expect(useSharedImportStore.getState().file?.name).toBe('train.ics');
});
+1 -1
View File
@@ -16,7 +16,7 @@ import { isNativeIos } from './platform';
* Nothing is prefetched through here: Mapbox forbids bulk downloads, and the
* OpenFreeMap region a trip stores goes through Cache Storage (offlineTiles.ts).
*/
export const TILE_CACHE_SCHEME = 'trek-tile';
const TILE_CACHE_SCHEME = 'trek-tile';
export function tileCacheActive(): boolean {
return isNativeIos() && hasNativeFeature('tileCache');
+3 -1
View File
@@ -99,7 +99,8 @@ describe('todayOf and tripDayState', () => {
'2026-11-06',
() => 'D',
(t) => t
)!;
);
if (!today) throw new Error('the trip runs today');
expect(tripDayState(today, 8 * 60, 'done')).toMatchObject({ nextName: 'Museum', done: 0, total: 2 });
expect(tripDayState(today, 12 * 60, 'done')).toMatchObject({ nextName: 'Dinner', nextTime: '19:30', done: 1 });
expect(tripDayState(today, 22 * 60, 'done')).toMatchObject({ nextName: 'done', done: 2, nextTime: undefined });
@@ -119,6 +120,7 @@ describe('publishWidgets', () => {
path: '/trips/1',
dayLabel: 'D',
nextName: 'x',
nextTime: undefined,
done: 0,
total: 0,
});
+22 -15
View File
@@ -20,7 +20,7 @@ export interface WidgetLabels {
nothingPlanned: string;
}
export interface WidgetStop {
interface WidgetStop {
time: string | null;
name: string;
/** Minutes after midnight, for picking the next stop; not sent to the widget. */
@@ -54,13 +54,13 @@ function minutesOf(time: string | null | undefined): number | null {
* and trips already over are not candidates.
*/
export function pickTrip(trips: Trip[], today: string): Trip | null {
const dated = trips.filter((t) => t.start_date && t.end_date && !t.is_archived);
const running = dated.find((t) => t.start_date! <= today && t.end_date! >= today);
if (running) return running;
const upcoming = dated
.filter((t) => t.start_date! > today)
.sort((a, b) => a.start_date!.localeCompare(b.start_date!));
return upcoming[0] ?? null;
const dated = trips.flatMap((t) =>
t.start_date && t.end_date && !t.is_archived ? [{ trip: t, start: t.start_date, end: t.end_date }] : []
);
const running = dated.find((d) => d.start <= today && d.end >= today);
if (running) return running.trip;
const upcoming = dated.filter((d) => d.start > today).sort((a, b) => a.start.localeCompare(b.start));
return upcoming[0]?.trip ?? null;
}
/** Today's day of the trip with its stops in plan order, if the trip runs today. */
@@ -77,18 +77,25 @@ export function todayOf(
const day = ordered[index];
const stops = [...(day.assignments ?? [])]
.sort((a, b) => (a.order_index ?? 0) - (b.order_index ?? 0))
.filter((a) => a.place?.name)
.map((a) => ({
name: a.place!.name,
time: a.place?.place_time ? formatTime(a.place.place_time.slice(0, 5)) : null,
minutes: minutesOf(a.place?.place_time),
}));
.flatMap((a) =>
a.place?.name
? [
{
name: a.place.name,
time: a.place.place_time ? formatTime(a.place.place_time.slice(0, 5)) : null,
minutes: minutesOf(a.place.place_time),
},
]
: []
);
return { tripTitle: trip.title, path: `/trips/${trip.id}`, dayLabel: dayLabel(index + 1, ordered.length), stops };
}
export function buildSnapshot(trip: Trip | null, day: TripDay | null, labels: WidgetLabels): WidgetSnapshot {
return {
trip: trip ? { title: trip.title, start: trip.start_date!, end: trip.end_date!, path: `/trips/${trip.id}` } : null,
trip: trip
? { title: trip.title, start: trip.start_date ?? '', end: trip.end_date ?? '', path: `/trips/${trip.id}` }
: null,
today: day ? { dayLabel: day.dayLabel, stops: day.stops.map(({ time, name }) => ({ time, name })) } : null,
labels,
};