From 665751961e66d6c30820284dc82ee1d9523e7958 Mon Sep 17 00:00:00 2001 From: DocNR Date: Mon, 24 Feb 2025 22:49:51 -0500 Subject: [PATCH] delete exercise tracker --- components/workout/ExerciseTracker.tsx | 149 ------------------------- 1 file changed, 149 deletions(-) delete mode 100644 components/workout/ExerciseTracker.tsx diff --git a/components/workout/ExerciseTracker.tsx b/components/workout/ExerciseTracker.tsx deleted file mode 100644 index 649cf02..0000000 --- a/components/workout/ExerciseTracker.tsx +++ /dev/null @@ -1,149 +0,0 @@ -// components/workout/ExerciseTracker.tsx -import React, { useCallback } from 'react'; -import { View, ScrollView } from 'react-native'; -import { Text } from '@/components/ui/text'; -import { Button } from '@/components/ui/button'; -import { ChevronLeft, ChevronRight, Plus, TimerReset, Dumbbell } from 'lucide-react-native'; -import { Card, CardContent } from '@/components/ui/card'; -import SetInput from '@/components/workout/SetInput'; -import { useWorkoutStore } from '@/stores/workoutStore'; -import { generateId } from '@/utils/ids'; -import type { WorkoutSet } from '@/types/workout'; -import { cn } from '@/lib/utils'; -import { useRouter } from 'expo-router'; - -export default function ExerciseTracker() { - const router = useRouter(); - const activeWorkout = useWorkoutStore.use.activeWorkout(); - const currentExerciseIndex = useWorkoutStore.use.currentExerciseIndex(); - const { nextExercise, previousExercise, startRest, updateSet } = useWorkoutStore.getState(); - - // Handle adding a new set - define callback before any conditional returns - const handleAddSet = useCallback(() => { - if (!activeWorkout?.exercises[currentExerciseIndex]) return; - - const currentExercise = activeWorkout.exercises[currentExerciseIndex]; - const lastSet = currentExercise.sets[currentExercise.sets.length - 1]; - const newSet: WorkoutSet = { - id: generateId('local'), - weight: lastSet?.weight || 0, - reps: lastSet?.reps || 0, - type: 'normal', - isCompleted: false - }; - - updateSet(currentExerciseIndex, currentExercise.sets.length, newSet); - }, [activeWorkout, currentExerciseIndex, updateSet]); - - // Empty state check after hooks - if (!activeWorkout?.exercises || activeWorkout.exercises.length === 0) { - return ( - - - - - - No exercises added - - Tap the + button to add exercises to your workout - - - - ); - } - - // Prepare derivative state after hooks - const currentExercise = activeWorkout.exercises[currentExerciseIndex]; - const hasNextExercise = currentExerciseIndex < activeWorkout.exercises.length - 1; - const hasPreviousExercise = currentExerciseIndex > 0; - - if (!currentExercise) return null; - - return ( - - {/* Exercise Navigation */} - - - - - - {currentExercise.title} - - - {currentExercise.equipment} • {currentExercise.category} - - - - - - - {/* Sets List */} - - - - {/* Header Row */} - - Set - Prev - kg - Reps - - - - {/* Sets */} - {currentExercise.sets.map((set: WorkoutSet, index: number) => ( - 0 ? currentExercise.sets[index - 1] : undefined} - /> - ))} - - - - - {/* Bottom Controls */} - - - - - - - ); -} \ No newline at end of file