// components/exercises/ExerciseDetails.tsx import React from 'react'; import { View, ScrollView } from 'react-native'; import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs'; import { Text } from '@/components/ui/text'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Separator } from '@/components/ui/separator'; import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import { Edit2, Dumbbell, Target, Calendar, Hash, AlertCircle, LineChart, Settings } from 'lucide-react-native'; import { ExerciseDisplay } from '@/types/exercise'; import { useTheme } from '@react-navigation/native'; import type { CustomTheme } from '@/lib/theme'; const Tab = createMaterialTopTabNavigator(); interface ExerciseDetailsProps { exercise: ExerciseDisplay; open: boolean; onOpenChange: (open: boolean) => void; onEdit?: () => void; } // Info Tab Component function InfoTab({ exercise, onEdit }: { exercise: ExerciseDisplay; onEdit?: () => void }) { const { title, type, category, equipment, description, instructions = [], tags = [], source = 'local', usageCount, lastUsed } = exercise; return ( {/* Basic Info Section */} {source} {type} {/* Category & Equipment Section */} Category {category} {equipment && ( Equipment {equipment} )} {/* Description Section */} {description && ( Description {description} )} {/* Tags Section */} {tags.length > 0 && ( Tags {tags.map((tag: string) => ( {tag} ))} )} {/* Usage Stats Section */} {(usageCount || lastUsed) && ( Usage {usageCount && ( Used {usageCount} times )} {lastUsed && ( Last used: {lastUsed.toLocaleDateString()} )} )} {/* Edit Button */} {onEdit && ( )} ); } // Progress Tab Component function ProgressTab({ exercise }: { exercise: ExerciseDisplay }) { return ( {/* Placeholder for Charts */} Progress charts coming soon {/* Personal Records Section */} Personal Records Max Weight -- kg Max Reps -- Best Volume -- kg ); } // Form Tab Component function FormTab({ exercise }: { exercise: ExerciseDisplay }) { const { instructions = [] } = exercise; return ( {/* Instructions Section */} {instructions.length > 0 ? ( Instructions {instructions.map((instruction: string, index: number) => ( {index + 1}. {instruction} ))} ) : ( No form instructions available )} {/* Placeholder for Media */} Video demos coming soon ); } // Settings Tab Component function SettingsTab({ exercise }: { exercise: ExerciseDisplay }) { return ( {/* Format Settings */} Exercise Settings Format {exercise.format && Object.entries(exercise.format).map(([key, enabled]) => ( enabled && ( {key} ) ))} Units {exercise.format_units && Object.entries(exercise.format_units).map(([key, unit]) => ( {key}: {String(unit)} ))} ); } export function ExerciseDetails({ exercise, open, onOpenChange, onEdit }: ExerciseDetailsProps) { const theme = useTheme() as CustomTheme; return ( onOpenChange(false)}> {exercise.title} {() => } {() => } {() => } {() => } ); }