// app/(workout)/template/[id]/index.tsx import React from 'react'; import { View, ScrollView } from 'react-native'; 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 { Card, CardContent } from '@/components/ui/card'; import { useTemplate } from './_templateContext'; import { formatTime } from '@/utils/formatTime'; import { Edit2, Copy, Share2, Dumbbell, Target, Calendar, Hash, Clock, Award } from 'lucide-react-native'; export default function OverviewTab() { const template = useTemplate(); const { title, type, category, description, exercises = [], tags = [], metadata, availability } = template; // Calculate source type from availability const sourceType = availability.source.includes('nostr') ? 'nostr' : availability.source.includes('powr') ? 'powr' : 'local'; const isEditable = sourceType === 'local'; return ( {/* Basic Info Section */} {sourceType === 'local' ? 'My Template' : sourceType === 'powr' ? 'POWR Template' : 'Nostr Template'} {type} {/* Category Section */} Category {category} {/* Description Section */} {description && ( Description {description} )} {/* Exercises Section */} Exercises {exercises.map((exerciseConfig, index) => ( {exerciseConfig.exercise.title} {exerciseConfig.targetSets} sets × {exerciseConfig.targetReps} reps {exerciseConfig.notes && ( {exerciseConfig.notes} )} ))} {/* Tags Section */} {tags.length > 0 && ( Tags {tags.map(tag => ( {tag} ))} )} {/* Workout Parameters Section */} Workout Parameters {template.rounds && ( Rounds: {template.rounds} )} {template.duration && ( Duration: {formatTime(template.duration * 1000)} )} {template.interval && ( Interval: {formatTime(template.interval * 1000)} )} {template.restBetweenRounds && ( Rest Between Rounds: {formatTime(template.restBetweenRounds * 1000)} )} {metadata?.averageDuration && ( Average Completion Time: {Math.round(metadata.averageDuration / 60)} minutes )} {/* Usage Stats Section */} {metadata && ( Usage {metadata.useCount && ( Used {metadata.useCount} times )} {metadata.lastUsed && ( Last used: {new Date(metadata.lastUsed).toLocaleDateString()} )} )} {/* Action Buttons */} {isEditable ? ( ) : ( )} ); }