diff --git a/global.d.ts b/global.d.ts new file mode 100644 index 0000000..ef6d741 --- /dev/null +++ b/global.d.ts @@ -0,0 +1 @@ +declare module "*.css" {} diff --git a/src/components/SwipeableRow.tsx b/src/components/SwipeableRow.tsx index ba58587..1fb27a5 100644 --- a/src/components/SwipeableRow.tsx +++ b/src/components/SwipeableRow.tsx @@ -1,6 +1,6 @@ import { useRef } from "react"; import { View, Text, Pressable, Animated, StyleSheet } from "react-native"; -import { PanGestureHandler, State, PanGestureHandlerGestureEvent } from "react-native-gesture-handler"; +import { PanGestureHandler, State, PanGestureHandlerGestureEvent, PanGestureHandlerStateChangeEvent } from "react-native-gesture-handler"; type SwipeableRowProps = { children: React.ReactNode; @@ -20,8 +20,8 @@ export function SwipeableRow({ children, onDelete, deleteLabel = "Delete" }: Swi translateX.setValue(clamped); }; - const onHandlerStateChange = (event: PanGestureHandlerGestureEvent) => { - if (event.oldState === State.ACTIVE) { + const onHandlerStateChange = (event: PanGestureHandlerStateChangeEvent) => { + if (event.nativeEvent.oldState === State.ACTIVE) { const { translationX } = event.nativeEvent; const final = Math.max(MAX_LEFT, Math.min(0, offset.current + translationX)); diff --git a/src/db/operations.ts b/src/db/operations.ts index a23675e..250bf69 100644 --- a/src/db/operations.ts +++ b/src/db/operations.ts @@ -2,7 +2,7 @@ import { db } from "./client"; import { generateUUID } from "../utils/uuid"; import { workouts, workoutSessions, sets, laps, templates } from "./schema"; import { eq, desc, sql } from "drizzle-orm"; -import type { WorkoutSet, LapData } from "@types/workout"; +import type { WorkoutSet, LapData } from "@/types/workout"; import WatchConnectivity from "../modules/watch-connectivity"; // ─── Templates ─────────────────────────────────────────────── @@ -253,7 +253,7 @@ export async function deleteSession(sessionId: string) { export async function deleteSessionAndSync(sessionId: string) { await deleteSession(sessionId); - WatchConnectivity.sendWorkoutDeleted(sessionId).catch((err) => + WatchConnectivity.sendWorkoutDeleted(sessionId).catch((err: Error) => console.warn("[ops] sync failed:", err) ); } @@ -274,7 +274,7 @@ export async function deleteWorkout(id: string) { export async function deleteWorkoutAndSync(id: string) { await deleteWorkout(id); - WatchConnectivity.sendWorkoutDeleted(id).catch((err) => + WatchConnectivity.sendWorkoutDeleted(id).catch((err: Error) => console.warn("[ops] sync failed:", err) ); } diff --git a/src/features/active-workout/screens/PreSwimScreen.tsx b/src/features/active-workout/screens/PreSwimScreen.tsx index 40768eb..2e77e91 100644 --- a/src/features/active-workout/screens/PreSwimScreen.tsx +++ b/src/features/active-workout/screens/PreSwimScreen.tsx @@ -10,7 +10,7 @@ import { useSyncWorkout } from "../../watch-connectivity/hooks/useSyncWorkout"; import { useWatchConnection } from "../../watch-connectivity/hooks/useWatchConnection"; import { formatDistance } from "@utils/formatDistance"; import { STROKE_COLORS } from "@constants/strokes"; -import type { WorkoutSet } from "@types/workout"; +import type { WorkoutSet } from "@/types/workout"; type WorkoutWithSets = { id: string; diff --git a/src/features/templates/hooks/useTemplates.ts b/src/features/templates/hooks/useTemplates.ts index 28fe327..c848ccf 100644 --- a/src/features/templates/hooks/useTemplates.ts +++ b/src/features/templates/hooks/useTemplates.ts @@ -1,6 +1,6 @@ import { useEffect, useState, useCallback } from "react"; import { getTemplates, deleteTemplate, toggleTemplateFavorite } from "@db/operations"; -import type { WorkoutSet } from "@types/workout"; +import type { WorkoutSet } from "@/types/workout"; type Template = { id: string; diff --git a/src/features/watch-connectivity/hooks/useSyncWorkout.ts b/src/features/watch-connectivity/hooks/useSyncWorkout.ts index d276272..41b7e83 100644 --- a/src/features/watch-connectivity/hooks/useSyncWorkout.ts +++ b/src/features/watch-connectivity/hooks/useSyncWorkout.ts @@ -2,7 +2,7 @@ import { useState } from "react"; import { Platform } from "react-native"; import WatchConnectivity from "../../../modules/watch-connectivity"; import WearConnectivity from "../../../modules/wear-connectivity"; -import type { WorkoutSet } from "@types/workout"; +import type { WorkoutSet } from "@/types/workout"; type SyncResult = { status: string } | { error: string }; diff --git a/src/features/workout-builder/hooks/useWorkoutBuilder.ts b/src/features/workout-builder/hooks/useWorkoutBuilder.ts index 961acfd..0865a8a 100644 --- a/src/features/workout-builder/hooks/useWorkoutBuilder.ts +++ b/src/features/workout-builder/hooks/useWorkoutBuilder.ts @@ -1,5 +1,5 @@ import { useState, useCallback } from "react"; -import type { WorkoutSet, StrokeType, RestType } from "@types/workout"; +import type { WorkoutSet, StrokeType, RestType } from "@/types/workout"; import { saveWorkout, saveTemplate } from "@db/operations"; import i18n from "@i18n/index"; diff --git a/src/features/workout-builder/screens/BuilderScreen.tsx b/src/features/workout-builder/screens/BuilderScreen.tsx index c5a7c23..7ff8291 100644 --- a/src/features/workout-builder/screens/BuilderScreen.tsx +++ b/src/features/workout-builder/screens/BuilderScreen.tsx @@ -6,7 +6,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack"; import type { RootStackParamList } from "@navigation/types"; import { useWorkoutBuilder } from "../hooks/useWorkoutBuilder"; import { useSettings } from "../../../providers/WatchProvider"; -import type { StrokeType } from "@types/workout"; +import type { StrokeType } from "@/types/workout"; const STROKES: StrokeType[] = ["Freestyle", "Backstroke", "Breaststroke", "Butterfly", "Mixed"]; diff --git a/src/utils/calculatePace.ts b/src/utils/calculatePace.ts index 30894ad..90af52d 100644 --- a/src/utils/calculatePace.ts +++ b/src/utils/calculatePace.ts @@ -1,4 +1,4 @@ -import { type WorkoutSet } from "@types/workout"; +import { type WorkoutSet } from "@/types/workout"; export function calculateTotalDistance(sets: WorkoutSet[]): number { return sets.reduce((acc, set) => acc + set.distancePerRep * set.repCount, 0);