// components/exercises/ExerciseCard.tsx import React from 'react'; import { View, TouchableOpacity, Platform } from 'react-native'; import { Text } from '@/components/ui/text'; import { Card, CardContent } from '@/components/ui/card'; import { Button } from '@/components/ui/button'; import { Badge } from '@/components/ui/badge'; import { Trash2, Star } from 'lucide-react-native'; import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from '@/components/ui/alert-dialog'; import { Exercise } from '@/types/library'; interface ExerciseCardProps extends Exercise { onPress: () => void; onDelete: (id: string) => void; onFavorite?: () => void; } export function ExerciseCard({ id, title, category, equipment, description, tags = [], source = 'local', usageCount, lastUsed, onPress, onDelete, onFavorite }: ExerciseCardProps) { const [showSheet, setShowSheet] = React.useState(false); const [showDeleteAlert, setShowDeleteAlert] = React.useState(false); const handleDeletePress = () => { setShowDeleteAlert(true); }; const handleConfirmDelete = () => { onDelete(id); setShowDeleteAlert(false); }; const handleCardPress = () => { setShowSheet(true); onPress(); }; return ( <> {title} {source} {category} {equipment && ( {equipment} )} {description && ( {description} )} {(usageCount || lastUsed) && ( {usageCount && ( Used {usageCount} times )} {lastUsed && ( Last used: {lastUsed.toLocaleDateString()} )} )} {tags.length > 0 && ( {tags.map(tag => ( {tag} ))} )} {onFavorite && ( )} Delete Exercise Are you sure you want to delete {title}? This action cannot be undone. Cancel Delete {/* Bottom sheet section */} setShowSheet(false)}> {title} {description && ( Description {description} )} Details Category: {category} {equipment && Equipment: {equipment}} Source: {source} {(usageCount || lastUsed) && ( Statistics {usageCount && ( Used {usageCount} times )} {lastUsed && ( Last used: {lastUsed.toLocaleDateString()} )} )} {tags.length > 0 && ( Tags {tags.map(tag => ( {tag} ))} )} ); }