From e3f3b0458b45c8d03a6362397c869562e402f341 Mon Sep 17 00:00:00 2001 From: Maurice Date: Wed, 14 Oct 2026 20:54:44 +0200 Subject: [PATCH] style(tours): format the touched planner and map files --- client/src/components/Map/mapPress.test.ts | 8 +++--- .../components/Planner/SuggestionDropdown.tsx | 28 +++++++++++++++++-- .../Tours/planner/tourDurationInput.test.ts | 2 +- .../Tours/planner/tourDurationInput.ts | 3 +- .../Tours/planner/useWaypointPlaceNames.ts | 4 +-- client/src/repo/reverseGeocodeRepo.test.ts | 6 ++-- 6 files changed, 37 insertions(+), 14 deletions(-) diff --git a/client/src/components/Map/mapPress.test.ts b/client/src/components/Map/mapPress.test.ts index 32f6a41bb..b252c8dbe 100644 --- a/client/src/components/Map/mapPress.test.ts +++ b/client/src/components/Map/mapPress.test.ts @@ -30,9 +30,9 @@ function setup() { describe('isPlacementTap', () => { it('FE-MAP-PRESS-001: a short press that barely moved places', () => { expect(isPlacementTap({ travelPx: 0, durationMs: 80, pointers: 1 })).toBe(true); - expect(isPlacementTap({ travelPx: TAP_MAX_TRAVEL_PX - 0.5, durationMs: TAP_MAX_DURATION_MS - 1, pointers: 1 })).toBe( - true - ); + expect( + isPlacementTap({ travelPx: TAP_MAX_TRAVEL_PX - 0.5, durationMs: TAP_MAX_DURATION_MS - 1, pointers: 1 }) + ).toBe(true); }); it('FE-MAP-PRESS-002: 4 px of travel, 300 ms of hold or a second finger never place', () => { @@ -41,7 +41,7 @@ describe('isPlacementTap', () => { expect(isPlacementTap({ travelPx: 0, durationMs: 50, pointers: 2 })).toBe(false); }); - it('FE-MAP-PRESS-003: a click no press was seen for (keyboard, synthetic) is the map\'s own call', () => { + it("FE-MAP-PRESS-003: a click no press was seen for (keyboard, synthetic) is the map's own call", () => { expect(isPlacementTap(null)).toBe(true); }); }); diff --git a/client/src/components/Planner/SuggestionDropdown.tsx b/client/src/components/Planner/SuggestionDropdown.tsx index f30f3c566..df5fb5999 100644 --- a/client/src/components/Planner/SuggestionDropdown.tsx +++ b/client/src/components/Planner/SuggestionDropdown.tsx @@ -47,8 +47,23 @@ export function SuggestionInputBox({ className={floating ? 'focus-within:ring-2 focus-within:ring-accent' : 'bg-surface-tertiary'} style={ floating - ? { ...FLOATING_GLASS, display: 'flex', alignItems: 'center', gap: 8, height: 42, padding: '0 8px 0 14px', borderRadius: 999 } - : { display: 'flex', alignItems: 'center', gap: 6, padding: '8px 10px', borderRadius: 10, border: '1px solid var(--border-primary)' } + ? { + ...FLOATING_GLASS, + display: 'flex', + alignItems: 'center', + gap: 8, + height: 42, + padding: '0 8px 0 14px', + borderRadius: 999, + } + : { + display: 'flex', + alignItems: 'center', + gap: 6, + padding: '8px 10px', + borderRadius: 10, + border: '1px solid var(--border-primary)', + } } > {icon} @@ -100,7 +115,14 @@ interface SuggestionListProps { } /** The floating list under the field. Rendered only while it is loading, has rows or a status; the caller checks `open`. */ -export function SuggestionList({ loading, rowCount, status, listbox, floating = false, children }: SuggestionListProps) { +export function SuggestionList({ + loading, + rowCount, + status, + listbox, + floating = false, + children, +}: SuggestionListProps) { const { t } = useTranslation(); if (!loading && rowCount === 0 && !status) return null; return ( diff --git a/client/src/components/Tours/planner/tourDurationInput.test.ts b/client/src/components/Tours/planner/tourDurationInput.test.ts index c90118758..324860f7e 100644 --- a/client/src/components/Tours/planner/tourDurationInput.test.ts +++ b/client/src/components/Tours/planner/tourDurationInput.test.ts @@ -35,7 +35,7 @@ describe('parseTourDuration', () => { 'rejects %j', (text) => { expect(parseTourDuration(text)).toBe('invalid'); - }, + } ); it('reads back everything it formats', () => { diff --git a/client/src/components/Tours/planner/tourDurationInput.ts b/client/src/components/Tours/planner/tourDurationInput.ts index 053a52ca3..770043a2f 100644 --- a/client/src/components/Tours/planner/tourDurationInput.ts +++ b/client/src/components/Tours/planner/tourDurationInput.ts @@ -11,7 +11,8 @@ const CLOCK = /^(\d+):(\d{1,2})$/; // Hours with a unit, then minutes with an optional unit, or minutes alone with a unit: // "2 h 56", "2h56min", "1,5 h", "45 min". Each part is anchored on its unit, so the // pattern cannot match one text two ways. -const WITH_UNITS = /^(?:(\d+(?:[.,]\d+)?) ?(?:h|hr|hrs|hours?|std|stunden?)\.?)? ?(?:(\d+) ?(?:m|min|mins|minutes?|minuten?)?\.?)?$/; +const WITH_UNITS = + /^(?:(\d+(?:[.,]\d+)?) ?(?:h|hr|hrs|hours?|std|stunden?)\.?)? ?(?:(\d+) ?(?:m|min|mins|minutes?|minuten?)?\.?)?$/; /** * Reads what somebody typed into a duration field as whole minutes. diff --git a/client/src/components/Tours/planner/useWaypointPlaceNames.ts b/client/src/components/Tours/planner/useWaypointPlaceNames.ts index a003ebfbc..f0857d46c 100644 --- a/client/src/components/Tours/planner/useWaypointPlaceNames.ts +++ b/client/src/components/Tours/planner/useWaypointPlaceNames.ts @@ -40,12 +40,12 @@ export function useWaypointPlaceNames(waypoints: WaypointCoordinate[]): Record current[point.id]?.key === point.key && current[point.id]?.name === name ? current - : { ...current, [point.id]: { key: point.key, name } }, + : { ...current, [point.id]: { key: point.key, name } } ); }, () => { // Offline or a failed lookup: the row keeps showing the coordinates. - }, + } ); } }, SETTLE_MS); diff --git a/client/src/repo/reverseGeocodeRepo.test.ts b/client/src/repo/reverseGeocodeRepo.test.ts index ffa8b1921..ba44b5aae 100644 --- a/client/src/repo/reverseGeocodeRepo.test.ts +++ b/client/src/repo/reverseGeocodeRepo.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'; -import { reverseGeocodeRepo } from './reverseGeocodeRepo'; -import { isEffectivelyOffline } from '../sync/networkMode'; import { mapsApi } from '../api/client'; +import { isEffectivelyOffline } from '../sync/networkMode'; +import { reverseGeocodeRepo } from './reverseGeocodeRepo'; vi.mock('../sync/networkMode', () => ({ isEffectivelyOffline: vi.fn(() => false) })); vi.mock('../api/client', () => ({ mapsApi: { reverse: vi.fn() } })); @@ -55,7 +55,7 @@ describe('reverse geocoded place names', () => { () => new Promise((resolve) => { resolvers.push(resolve); - }), + }) ); const names = [1, 2, 3].map((n) => reverseGeocodeRepo.placeName(46 + n, 11, 'de')); expect(mapsApi.reverse).toHaveBeenCalledTimes(2);