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(tours): resolve client lint warnings

elmocitodd43999f1f07
diff --git a/client/src/components/Map/MapViewGL.test.tsx b/client/src/components/Map/MapViewGL.test.tsx
index 98a1fc14c..359e3c094 100644
--- a/client/src/components/Map/MapViewGL.test.tsx
+++ b/client/src/components/Map/MapViewGL.test.tsx
@@ -959,7 +959,7 @@ describe('MapViewGL', () => {
await act(async () => {});
expect(glMap.fitBounds).toHaveBeenCalledOnce();
expect(glMap.fitBounds).toHaveBeenCalledWith(expect.anything(), expect.objectContaining({ maxZoom: 15 }));
- const mapConstructions = (maplibregl.Map as any).mock.calls.length;
+ const mapConstructions = vi.mocked(maplibregl.Map).mock.calls.length;
glMap.fitBounds.mockClear();
rerender(
@@ -974,7 +974,7 @@ describe('MapViewGL', () => {
);
await act(async () => {});
expect(glMap.fitBounds).not.toHaveBeenCalled();
- expect((maplibregl.Map as any).mock.calls).toHaveLength(mapConstructions);
+ expect(vi.mocked(maplibregl.Map).mock.calls).toHaveLength(mapConstructions);
rerender(
<MapViewGL
diff --git a/client/src/components/Tours/TourDayRowFacts.test.tsx b/client/src/components/Tours/TourDayRowFacts.test.tsx
index 5c9780840..7ba87cda9 100644
--- a/client/src/components/Tours/TourDayRowFacts.test.tsx
+++ b/client/src/components/Tours/TourDayRowFacts.test.tsx
@@ -2,7 +2,8 @@ import type { TourListItem } from '@trek/shared';
import { Bike, Footprints, Mountain, Route } from 'lucide-react';
import { describe, expect, it, vi } from 'vitest';
import { fireEvent, render, screen } from '../../../tests/helpers/render';
-import TourDayRowFacts, { TourDayRowIcon, tourDayRowIcon } from './TourDayRowFacts';
+import TourDayRowFacts, { TourDayRowIcon } from './TourDayRowFacts';
+import { tourDayRowIcon } from './tourDayRowIcon';
const tour: TourListItem = {
place_id: 42,
diff --git a/client/src/components/Tours/TourDayRowFacts.tsx b/client/src/components/Tours/TourDayRowFacts.tsx
index a90f6dd69..058d306ed 100644
--- a/client/src/components/Tours/TourDayRowFacts.tsx
+++ b/client/src/components/Tours/TourDayRowFacts.tsx
@@ -1,38 +1,13 @@
import type { TourListItem } from '@trek/shared';
-import {
- ArrowUp,
- Bike,
- Clock,
- Footprints,
- Mountain,
- Pause,
- Route,
- Ruler,
- Sailboat,
- type LucideIcon,
-} from 'lucide-react';
+import { ArrowUp, Clock, Footprints, Pause, Ruler, type LucideIcon } from 'lucide-react';
import { useId, useState } from 'react';
import { useTranslation } from '../../i18n';
import { useSettingsStore } from '../../store/settingsStore';
import { formatDistance, formatElevation } from '../../utils/units';
import { Tooltip } from '../shared/Tooltip';
+import { tourDayRowIcon } from './tourDayRowIcon';
import { formatPlannedTourDuration, tourPlannedTimes } from './tourPresentation';
-export function tourDayRowIcon(type: string): LucideIcon {
- switch (type) {
- case 'hike':
- return Mountain;
- case 'bike':
- return Bike;
- case 'walk':
- return Footprints;
- case 'kayak':
- return Sailboat;
- default:
- return Route;
- }
-}
-
export function TourDayRowIcon({ type, size = 27 }: { type: string; size?: number }) {
const { t } = useTranslation();
const Icon = tourDayRowIcon(type);
diff --git a/client/src/components/Tours/tourDayRowIcon.ts b/client/src/components/Tours/tourDayRowIcon.ts
new file mode 100644
index 000000000..6246392a4
--- /dev/null
+++ b/client/src/components/Tours/tourDayRowIcon.ts
@@ -0,0 +1,16 @@
+import { Bike, Footprints, Mountain, Route, Sailboat, type LucideIcon } from 'lucide-react';
+
+export function tourDayRowIcon(type: string): LucideIcon {
+ switch (type) {
+ case 'hike':
+ return Mountain;
+ case 'bike':
+ return Bike;
+ case 'walk':
+ return Footprints;
+ case 'kayak':
+ return Sailboat;
+ default:
+ return Route;
+ }
+}