/** * Voller Katalog-Inhalt einer Übung (Lesemodus für Coach/Mobile). * Optional: geplante Variante (`variantId`) — Beschreibung und Durchführungsänderungen oben. */ import React from 'react' import { Link } from 'react-router-dom' import ExerciseRichTextBlock from './ExerciseRichTextBlock' function TagRow({ exercise }) { const tags = [] ;(exercise.focus_areas || []).forEach((f) => { tags.push({ key: `fa-${f.id}`, label: f.name, accent: !!f.is_primary }) }) ;(exercise.training_styles || []).forEach((t) => { tags.push({ key: `ts-${t.id}`, label: t.name, accent: false }) }) ;(exercise.training_types || []).forEach((t) => { tags.push({ key: `tt-${t.id}`, label: t.name, accent: false }) }) ;(exercise.target_groups || []).forEach((g) => { tags.push({ key: `tg-${g.id}`, label: g.name, accent: !!g.is_primary }) }) if (tags.length === 0) return null return (
{tags.map((t) => ( {t.label} ))}
) } function metaParts(exercise) { const parts = [] if (exercise.duration_min != null || exercise.duration_max != null) { const a = exercise.duration_min const b = exercise.duration_max if (a != null && b != null && a !== b) parts.push(`${a}–${b} Min.`) else if (a != null) parts.push(`ca. ${a} Min.`) else if (b != null) parts.push(`ca. ${b} Min.`) } if (exercise.group_size_min != null || exercise.group_size_max != null) { const a = exercise.group_size_min const b = exercise.group_size_max if (a != null && b != null && a !== b) parts.push(`Gruppe ${a}–${b}`) else if (a != null) parts.push(`Gruppe ab ${a}`) else if (b != null) parts.push(`Gruppe bis ${b}`) } return parts } /** * @param {{ exercise?: object|null, loading?: boolean, error?: string|null, exerciseId?: number, variantId?: number|string|null }} props */ export default function ExerciseFullContent({ exercise, loading, error, exerciseId, variantId }) { if (loading) { return (

Übung aus Katalog laden…

) } if (error) { return

{error}

} if (!exercise) return null const resolvedId = exercise.id ?? exerciseId const meta = metaParts(exercise) const variant = variantId != null && variantId !== '' && Array.isArray(exercise.variants) && exercise.variants.length ? exercise.variants.find((v) => String(v.id) === String(variantId)) || null : null return (
{variant ? (

Geplante Variante

{variant.variant_name || `Variante #${variant.id}`}

{variant.description ? (

Zur Variante

) : null} {variant.execution_changes ? (

Durchführung (Variante)

) : null}
) : null}

{exercise.title}

{meta.length > 0 && (

{meta.join(' · ')}

)} {exercise.summary && (

Kurzbeschreibung

)} {exercise.goal && (

Ziel

)} {(exercise.equipment || []).length > 0 && (

Material & Aufbau

    {exercise.equipment.map((x, i) => (
  • {x}
  • ))}
)} {exercise.preparation && (

Vorbereitung

)} {exercise.execution && (

Ablauf

)} {exercise.trainer_notes && (

Hinweise Trainer (Katalog)

)} {exerciseId != null && (

Volle Übungsseite im Browser

)}
) }