"use client"; import { Card } from "@/components/ui/Card"; import type { InjuryType } from "@/lib/types"; interface InjuryStepProps { injuryTypes: InjuryType[]; onChange: (injuries: InjuryType[]) => void; } const INJURY_AREAS: { type: string; label: string; icon: string }[] = [ { type: "knee", label: "Knee", icon: "🦵" }, { type: "lower_back", label: "Lower Back", icon: "🔻" }, { type: "upper_back", label: "Upper Back", icon: "🔺" }, { type: "shoulder", label: "Shoulder", icon: "💪" }, { type: "hip", label: "Hip", icon: "🦴" }, { type: "wrist", label: "Wrist", icon: "✋" }, { type: "ankle", label: "Ankle", icon: "🦶" }, { type: "neck", label: "Neck", icon: "🧣" }, ]; const SEVERITY_OPTIONS: { value: "mild" | "moderate" | "severe"; label: string; color: string; bgColor: string; borderColor: string; }[] = [ { value: "mild", label: "Mild", color: "text-yellow-400", bgColor: "bg-yellow-500/10", borderColor: "border-yellow-500/50", }, { value: "moderate", label: "Moderate", color: "text-orange-400", bgColor: "bg-orange-500/10", borderColor: "border-orange-500/50", }, { value: "severe", label: "Severe", color: "text-red-400", bgColor: "bg-red-500/10", borderColor: "border-red-500/50", }, ]; export function InjuryStep({ injuryTypes, onChange }: InjuryStepProps) { const getInjury = (type: string): InjuryType | undefined => injuryTypes.find((i) => i.type === type); const toggleInjury = (type: string) => { const existing = getInjury(type); if (existing) { onChange(injuryTypes.filter((i) => i.type !== type)); } else { onChange([...injuryTypes, { type, severity: "moderate" }]); } }; const setSeverity = (type: string, severity: "mild" | "moderate" | "severe") => { onChange( injuryTypes.map((i) => (i.type === type ? { ...i, severity } : i)) ); }; const getSeverityStyle = (type: string) => { const injury = getInjury(type); if (!injury) return ""; const opt = SEVERITY_OPTIONS.find((s) => s.value === injury.severity); return opt ? `${opt.borderColor} ${opt.bgColor}` : ""; }; return (
Select any body areas with current injuries. We will adjust your workouts to avoid aggravating them. You can skip this step if you have no injuries.
{injuryTypes.length} area{injuryTypes.length !== 1 ? "s" : ""} selected. {" "} Exercises that could aggravate these areas will be excluded or modified based on severity level.