// components/library/NewTemplateSheet.tsx import React, { useState, useEffect } from 'react'; import { View, ScrollView, TouchableOpacity, Modal } from 'react-native'; import { Text } from '@/components/ui/text'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Textarea } from '@/components/ui/textarea'; import { Badge } from '@/components/ui/badge'; import { Template, TemplateType, TemplateCategory, TemplateExerciseDisplay } from '@/types/templates'; import { ExerciseDisplay } from '@/types/exercise'; import { generateId } from '@/utils/ids'; import { useSQLiteContext } from 'expo-sqlite'; import { LibraryService } from '@/lib/db/services/LibraryService'; import { ChevronLeft, Dumbbell, Clock, RotateCw, List, Search, X } from 'lucide-react-native'; import { useColorScheme } from '@/lib/theme/useColorScheme'; interface NewTemplateSheetProps { isOpen: boolean; onClose: () => void; onSubmit: (template: Template) => void; } // Steps in template creation type CreationStep = 'type' | 'info' | 'exercises' | 'config' | 'review'; // Purple color used throughout the app const purpleColor = 'hsl(261, 90%, 66%)'; // Enhanced template exercise display that includes the original exercise object interface EnhancedTemplateExerciseDisplay extends TemplateExerciseDisplay { exercise: ExerciseDisplay; } // Step 0: Workout Type Selection interface WorkoutTypeStepProps { onSelectType: (type: TemplateType) => void; onCancel: () => void; } function WorkoutTypeStep({ onSelectType, onCancel }: WorkoutTypeStepProps) { const workoutTypes = [ { type: 'strength' as TemplateType, title: 'Strength Workout', description: 'Traditional sets and reps with rest periods', icon: Dumbbell, available: true }, { type: 'circuit' as TemplateType, title: 'Circuit Training', description: 'Multiple exercises performed in sequence', icon: RotateCw, available: false }, { type: 'emom' as TemplateType, title: 'EMOM Workout', description: 'Every Minute On the Minute timed exercises', icon: Clock, available: false }, { type: 'amrap' as TemplateType, title: 'AMRAP Workout', description: 'As Many Rounds As Possible in a time cap', icon: List, available: false } ]; return ( Select the type of workout template you want to create: {workoutTypes.map(workout => ( {workout.available ? ( onSelectType(workout.type)} className="flex-row justify-between items-center" activeOpacity={0.7} > {workout.title} {workout.description} ) : ( {workout.title} {workout.description} Coming Soon )} ))} ); } // Step 1: Basic Info interface BasicInfoStepProps { title: string; description: string; category: TemplateCategory; onTitleChange: (title: string) => void; onDescriptionChange: (description: string) => void; onCategoryChange: (category: string) => void; onNext: () => void; onCancel: () => void; } function BasicInfoStep({ title, description, category, onTitleChange, onDescriptionChange, onCategoryChange, onNext, onCancel }: BasicInfoStepProps) { const categories: TemplateCategory[] = ['Full Body', 'Custom', 'Push/Pull/Legs', 'Upper/Lower', 'Conditioning']; return ( Workout Name {!title && ( * Required field )} Description (Optional)