"use client"; import { Exercise } from "@prisma/client"; import Link from "next/link"; import { Dumbbell } from "lucide-react"; const TYPE_COLORS: Record = { barbell: "bg-red-900/50 text-red-400", dumbbell: "bg-blue-900/50 text-blue-400", machine: "bg-purple-900/50 text-purple-400", cable: "bg-amber-900/50 text-amber-400", bodyweight: "bg-green-900/50 text-green-400", cardio: "bg-orange-900/50 text-orange-400", kettlebell: "bg-yellow-900/50 text-yellow-400", other: "bg-zinc-800 text-zinc-400", }; export default function ExerciseCard({ exercise }: { exercise: Exercise }) { const muscleGroups = JSON.parse(exercise.muscleGroups || "[]") as string[]; const typeColor = TYPE_COLORS[exercise.type] || TYPE_COLORS.other; return (

{exercise.name}

{exercise.type.charAt(0).toUpperCase() + exercise.type.slice(1)}
{exercise.description && (

{exercise.description}

)} {muscleGroups.length > 0 && (
{muscleGroups.slice(0, 3).map((group) => ( {group.charAt(0).toUpperCase() + group.slice(1)} ))} {muscleGroups.length > 3 && ( +{muscleGroups.length - 3} )}
)}
); }