// components/library/NewTemplateSheet.tsx import React from 'react'; import { View } from 'react-native'; import { Text } from '@/components/ui/text'; import { Input } from '@/components/ui/input'; import { Button } from '@/components/ui/button'; import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import { generateId } from '@/utils/ids'; import { TemplateType, TemplateCategory } from '@/types/library'; import { cn } from '@/lib/utils'; interface NewTemplateSheetProps { isOpen: boolean; onClose: () => void; onSubmit: (template: Template) => void; } const WORKOUT_TYPES: TemplateType[] = ['strength', 'circuit', 'emom', 'amrap']; const CATEGORIES: TemplateCategory[] = [ 'Full Body', 'Upper/Lower', 'Push/Pull/Legs', 'Cardio', 'CrossFit', 'Strength', 'Conditioning', 'Custom' ]; export function NewTemplateSheet({ isOpen, onClose, onSubmit }: NewTemplateSheetProps) { const [formData, setFormData] = React.useState({ title: '', type: '' as TemplateType, category: '' as TemplateCategory, description: '', }); const handleSubmit = () => { const template: Template = { id: generateId(), title: formData.title, type: formData.type, category: formData.category, description: formData.description, exercises: [], tags: [], source: 'local', isFavorite: false, created_at: Date.now(), }; onSubmit(template); onClose(); setFormData({ title: '', type: '' as TemplateType, category: '' as TemplateCategory, description: '', }); }; return ( New Template Template Name setFormData(prev => ({ ...prev, title: text }))} placeholder="e.g., Full Body Strength" /> Workout Type {WORKOUT_TYPES.map((type) => ( ))} Category {CATEGORIES.map((category) => ( ))} Description setFormData(prev => ({ ...prev, description: text }))} placeholder="Template description..." multiline numberOfLines={4} /> ); }