diff --git a/client/src/components/Tours/TourGpxPreviewDialog.tsx b/client/src/components/Tours/TourGpxPreviewDialog.tsx index 7df48539d..5b04b7874 100644 --- a/client/src/components/Tours/TourGpxPreviewDialog.tsx +++ b/client/src/components/Tours/TourGpxPreviewDialog.tsx @@ -5,7 +5,6 @@ import { OFM_POSITRON } from '../../constants/mapDefaults'; import { useTileUrl } from '../../hooks/useTileUrl'; import { useTranslation } from '../../i18n'; import { useSettingsStore } from '../../store/settingsStore'; -import { formatDate } from '../../utils/formatters'; import { formatDistance, formatElevation } from '../../utils/units'; import { MapViewAuto } from '../Map/MapViewAuto'; import { SoftPill } from '../Planner/planParts'; @@ -20,7 +19,7 @@ import { fs, NEUTRAL_TINT, } from '../shared/DialogShell'; -import { recordedMinutes } from './activity/tourActivityModel'; +import { recordedDay, recordedMinutes } from './activity/tourActivityModel'; import { importFields, importMissing, useGpxImportChoices } from './gpxImportChoices'; import { GpxImportTypeSection } from './GpxImportTypeSection'; import { TourNotice } from './tourParts'; @@ -34,11 +33,12 @@ const BADGE = function RecordedBadge({ track }: { track: GpxPreviewFile['tracks'][number] }) { const { locale } = useTranslation(); const minutes = recordedMinutes(track.started_at, track.ended_at); - if (minutes === null || !track.started_at) return null; + const day = recordedDay(track.started_at, locale); + if (minutes === null || !day) return null; return ( - {formatDate(track.started_at.slice(0, 10), locale)} + {day} {formatPlannedTourDuration(minutes)} ); diff --git a/client/src/components/Tours/activity/TourActivityDialog.test.tsx b/client/src/components/Tours/activity/TourActivityDialog.test.tsx index 9feebc6a6..5852ceb42 100644 --- a/client/src/components/Tours/activity/TourActivityDialog.test.tsx +++ b/client/src/components/Tours/activity/TourActivityDialog.test.tsx @@ -37,7 +37,7 @@ function assignment(overrides: Partial = {}): TrackAssignment { selected: 20, choose: vi.fn(), choice: watch, - replaces: null, + replaces: [], gpxImport: { importing: false, preview: null, @@ -93,7 +93,7 @@ describe('TourActivityDialog (ACT-01)', () => { }); it('FE-ACT-DIALOG-003: nothing to link until a free recording is chosen; what it replaces is said', () => { - hook.assignment = assignment({ ready: false, choice: null, selected: null, replaces: 'Old export' }); + hook.assignment = assignment({ ready: false, choice: null, selected: null, replaces: ['Old export'] }); const current = state(); show(current); expect(screen.getByTestId('tour-activity-confirm')).toBeDisabled(); diff --git a/client/src/components/Tours/activity/TourActivityDialog.tsx b/client/src/components/Tours/activity/TourActivityDialog.tsx index 415872db4..75f1fbcb3 100644 --- a/client/src/components/Tours/activity/TourActivityDialog.tsx +++ b/client/src/components/Tours/activity/TourActivityDialog.tsx @@ -23,7 +23,7 @@ import { PillSelect } from '../../shared/dialogParts'; import TourGpxPreviewDialog from '../TourGpxPreviewDialog'; import { CardAction, TourMetricFields, TourNotice } from '../tourParts'; import { formatPlannedTourDuration, hikeSourceBadgeLabel } from '../tourPresentation'; -import { recordedMinutes, type TourExecution, type TrackCandidate } from './tourActivityModel'; +import { recordedDay, recordedMinutes, type TourExecution, type TrackCandidate } from './tourActivityModel'; import type { TourActivities } from './useTourActivities'; import { useTrackAssignment, type TrackAssignment } from './useTrackAssignment'; @@ -44,7 +44,7 @@ function CandidateRow({ const unit = useSettingsStore((store) => store.settings.distance_unit) ?? 'metric'; const { tour, takenBy } = candidate; const minutes = recordedMinutes(tour.track_started_at, tour.track_ended_at); - const recordedOn = tour.track_started_at ? formatDate(tour.track_started_at.slice(0, 10), locale) : null; + const recordedOn = recordedDay(tour.track_started_at, locale); return (