fix: correct path aliases and type imports across codebase
This commit is contained in:
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
declare module "*.css" {}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useRef } from "react";
|
import { useRef } from "react";
|
||||||
import { View, Text, Pressable, Animated, StyleSheet } from "react-native";
|
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 = {
|
type SwipeableRowProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
@@ -20,8 +20,8 @@ export function SwipeableRow({ children, onDelete, deleteLabel = "Delete" }: Swi
|
|||||||
translateX.setValue(clamped);
|
translateX.setValue(clamped);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onHandlerStateChange = (event: PanGestureHandlerGestureEvent) => {
|
const onHandlerStateChange = (event: PanGestureHandlerStateChangeEvent) => {
|
||||||
if (event.oldState === State.ACTIVE) {
|
if (event.nativeEvent.oldState === State.ACTIVE) {
|
||||||
const { translationX } = event.nativeEvent;
|
const { translationX } = event.nativeEvent;
|
||||||
const final = Math.max(MAX_LEFT, Math.min(0, offset.current + translationX));
|
const final = Math.max(MAX_LEFT, Math.min(0, offset.current + translationX));
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { db } from "./client";
|
|||||||
import { generateUUID } from "../utils/uuid";
|
import { generateUUID } from "../utils/uuid";
|
||||||
import { workouts, workoutSessions, sets, laps, templates } from "./schema";
|
import { workouts, workoutSessions, sets, laps, templates } from "./schema";
|
||||||
import { eq, desc, sql } from "drizzle-orm";
|
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";
|
import WatchConnectivity from "../modules/watch-connectivity";
|
||||||
|
|
||||||
// ─── Templates ───────────────────────────────────────────────
|
// ─── Templates ───────────────────────────────────────────────
|
||||||
@@ -253,7 +253,7 @@ export async function deleteSession(sessionId: string) {
|
|||||||
|
|
||||||
export async function deleteSessionAndSync(sessionId: string) {
|
export async function deleteSessionAndSync(sessionId: string) {
|
||||||
await deleteSession(sessionId);
|
await deleteSession(sessionId);
|
||||||
WatchConnectivity.sendWorkoutDeleted(sessionId).catch((err) =>
|
WatchConnectivity.sendWorkoutDeleted(sessionId).catch((err: Error) =>
|
||||||
console.warn("[ops] sync failed:", err)
|
console.warn("[ops] sync failed:", err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -274,7 +274,7 @@ export async function deleteWorkout(id: string) {
|
|||||||
|
|
||||||
export async function deleteWorkoutAndSync(id: string) {
|
export async function deleteWorkoutAndSync(id: string) {
|
||||||
await deleteWorkout(id);
|
await deleteWorkout(id);
|
||||||
WatchConnectivity.sendWorkoutDeleted(id).catch((err) =>
|
WatchConnectivity.sendWorkoutDeleted(id).catch((err: Error) =>
|
||||||
console.warn("[ops] sync failed:", err)
|
console.warn("[ops] sync failed:", err)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { useSyncWorkout } from "../../watch-connectivity/hooks/useSyncWorkout";
|
|||||||
import { useWatchConnection } from "../../watch-connectivity/hooks/useWatchConnection";
|
import { useWatchConnection } from "../../watch-connectivity/hooks/useWatchConnection";
|
||||||
import { formatDistance } from "@utils/formatDistance";
|
import { formatDistance } from "@utils/formatDistance";
|
||||||
import { STROKE_COLORS } from "@constants/strokes";
|
import { STROKE_COLORS } from "@constants/strokes";
|
||||||
import type { WorkoutSet } from "@types/workout";
|
import type { WorkoutSet } from "@/types/workout";
|
||||||
|
|
||||||
type WorkoutWithSets = {
|
type WorkoutWithSets = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useEffect, useState, useCallback } from "react";
|
import { useEffect, useState, useCallback } from "react";
|
||||||
import { getTemplates, deleteTemplate, toggleTemplateFavorite } from "@db/operations";
|
import { getTemplates, deleteTemplate, toggleTemplateFavorite } from "@db/operations";
|
||||||
import type { WorkoutSet } from "@types/workout";
|
import type { WorkoutSet } from "@/types/workout";
|
||||||
|
|
||||||
type Template = {
|
type Template = {
|
||||||
id: string;
|
id: string;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useState } from "react";
|
|||||||
import { Platform } from "react-native";
|
import { Platform } from "react-native";
|
||||||
import WatchConnectivity from "../../../modules/watch-connectivity";
|
import WatchConnectivity from "../../../modules/watch-connectivity";
|
||||||
import WearConnectivity from "../../../modules/wear-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 };
|
type SyncResult = { status: string } | { error: string };
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useCallback } from "react";
|
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 { saveWorkout, saveTemplate } from "@db/operations";
|
||||||
import i18n from "@i18n/index";
|
import i18n from "@i18n/index";
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import type { NativeStackNavigationProp } from "@react-navigation/native-stack";
|
|||||||
import type { RootStackParamList } from "@navigation/types";
|
import type { RootStackParamList } from "@navigation/types";
|
||||||
import { useWorkoutBuilder } from "../hooks/useWorkoutBuilder";
|
import { useWorkoutBuilder } from "../hooks/useWorkoutBuilder";
|
||||||
import { useSettings } from "../../../providers/WatchProvider";
|
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"];
|
const STROKES: StrokeType[] = ["Freestyle", "Backstroke", "Breaststroke", "Butterfly", "Mixed"];
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type WorkoutSet } from "@types/workout";
|
import { type WorkoutSet } from "@/types/workout";
|
||||||
|
|
||||||
export function calculateTotalDistance(sets: WorkoutSet[]): number {
|
export function calculateTotalDistance(sets: WorkoutSet[]): number {
|
||||||
return sets.reduce((acc, set) => acc + set.distancePerRep * set.repCount, 0);
|
return sets.reduce((acc, set) => acc + set.distancePerRep * set.repCount, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user