Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix(journey): sort the stay dates by a compare, make the hint pills real buttons and keep the walk's no-boats default a constant

Mauricebb3c0151d503
diff --git a/client/src/components/Dawarich/dawarichSuggestionModel.ts b/client/src/components/Dawarich/dawarichSuggestionModel.ts
index f987d337f..57c7c12f1 100644
--- a/client/src/components/Dawarich/dawarichSuggestionModel.ts
+++ b/client/src/components/Dawarich/dawarichSuggestionModel.ts
@@ -80,11 +80,11 @@ export function openStayDatesWithin(
byDate: Map<string, DawarichSuggestion[]>,
span: Array<string | null | undefined>
): string[] {
- const bounds = span.filter((date): date is string => !!date).sort();
+ const bounds = span.filter((date): date is string => !!date).sort((a, b) => a.localeCompare(b));
const first = bounds[0];
const last = bounds[bounds.length - 1];
if (!first || !last) return [];
- return [...byDate.keys()].filter((date) => date >= first && date <= last).sort();
+ return [...byDate.keys()].filter((date) => date >= first && date <= last).sort((a, b) => a.localeCompare(b));
}
/** `HH:MM` out of an ISO timestamp, in the offset the timestamp carries. */
diff --git a/client/src/components/Journey/JourneyDayImportReview.tsx b/client/src/components/Journey/JourneyDayImportReview.tsx
index dbfd1255b..1a95f6d6c 100644
--- a/client/src/components/Journey/JourneyDayImportReview.tsx
+++ b/client/src/components/Journey/JourneyDayImportReview.tsx
@@ -261,9 +261,9 @@ export function JourneyDayImportActions({ state, onCancel }: { state: JourneyDay
<>
{state.skipCount > 0 && (
<Tooltip label={t('journey.dayImport.skipHint')} placement="top">
- <span tabIndex={0} className="inline-flex">
+ <button type="button" className="inline-flex cursor-default">
<SoftPill>{t('journey.dayImport.skipped', { count: state.skipCount })}</SoftPill>
- </span>
+ </button>
</Tooltip>
)}
<FooterSpacer />
diff --git a/client/src/components/Journey/JourneyDayImportStays.tsx b/client/src/components/Journey/JourneyDayImportStays.tsx
index 6b0fb6de1..6bb31ae4a 100644
--- a/client/src/components/Journey/JourneyDayImportStays.tsx
+++ b/client/src/components/Journey/JourneyDayImportStays.tsx
@@ -17,9 +17,9 @@ type Props = { state: JourneyDayImportState; dayColor: string };
function Hinted({ label, children }: { label: string; children: ReactNode }) {
return (
<Tooltip label={label} placement="top">
- <span tabIndex={0} className="inline-flex">
+ <button type="button" className="inline-flex cursor-default">
{children}
- </span>
+ </button>
</Tooltip>
);
}
diff --git a/client/src/components/Journey/JourneyRecordingReview.tsx b/client/src/components/Journey/JourneyRecordingReview.tsx
index c32ee9984..77d6f5ae7 100644
--- a/client/src/components/Journey/JourneyRecordingReview.tsx
+++ b/client/src/components/Journey/JourneyRecordingReview.tsx
@@ -97,20 +97,20 @@ function RecordingFacts({ preview }: { preview: JourneyRecordingPreview }) {
<SoftPill>{t('journey.recording.pieces', { count: stats.segmentCount })}</SoftPill>
{stats.gapCount > 0 && (
<Tooltip label={t('journey.recording.gapsHint')} placement="top">
- <span tabIndex={0} className="inline-flex">
+ <button type="button" className="inline-flex cursor-default">
<SoftPill tone="info">{t('journey.recording.gaps', { count: stats.gapCount })}</SoftPill>
- </span>
+ </button>
</Tooltip>
)}
{stats.modes.map((mode) => (
<SoftPill key={mode}>{modeLabel(mode, t)}</SoftPill>
))}
<Tooltip label={t('journey.recording.sourceHint')} placement="top">
- <span tabIndex={0} className="inline-flex">
+ <button type="button" className="inline-flex cursor-default">
<SoftPill>
{t(preview.sourceKind === 'tracks' ? 'journey.recording.sourceTracks' : 'journey.recording.sourcePoints')}
</SoftPill>
- </span>
+ </button>
</Tooltip>
</div>
</div>
diff --git a/shared/src/tours/walk-hours.ts b/shared/src/tours/walk-hours.ts
index 4817a2844..0107e561f 100644
--- a/shared/src/tours/walk-hours.ts
+++ b/shared/src/tours/walk-hours.ts
@@ -333,6 +333,8 @@ export interface WalkBoats {
landings: Array<{ at: number; minutes: number | null }>;
}
+const NO_BOATS: Readonly<WalkBoats> = { spans: [], landings: [] };
+
/** Each stop's share of the walk with the index of the route's point it is passed at. */
function walkedAlong(
stops: readonly WalkStop[],
@@ -381,7 +383,7 @@ export function stationArrivals(
route: readonly RoutePoint[],
start: number | null,
walkingMinutes: number | null,
- boats: Readonly<WalkBoats> = { spans: [], landings: [] },
+ boats: Readonly<WalkBoats> = NO_BOATS,
): WalkArrival[] | null {
if (start === null || walkingMinutes === null) return null;
const walked = walkedAlong(stops, route, boats.spans);