Turnen: schlichte Gruppen als Bodenreihe direkt ins Bento (groupsInDash)

Neue opt-in-Prop groupsInDash in group-schedule zieht schlichte Gruppen
(ohne intro/details) als volle Bodenreihe MIT ins Dashboard-Bento, ohne
eigene Sektion und ohne "Unsere Gruppen"-Ueberschrift. Trampolin nutzt
das, damit Hinweis, Trainingsort, Kontakt und die drei Gruppen-Karten ein
zusammenhaengender Block sind statt einer losgeloesten Kartenreihe darunter.
Wiederverwendung von .group-list--grid/.group-card, Karten-Markup DRY in
renderSimpleCard. Wettkampfturnen/Kinderturnen bleiben unberuehrt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HXDvgRDHQ9iGjs4KCXykEj
This commit is contained in:
2026-08-03 19:58:39 +02:00
parent d410c0bedf
commit 1839632b66
3 changed files with 80 additions and 21 deletions

View File

@@ -36,6 +36,12 @@ declare(strict_types=1);
* $layout 'tabs' (Default) | 'stacked' — greift nur bei beschreibenden Gruppen.
* 'stacked' zeigt alle Karten offen untereinander (wenige Gruppen),
* 'tabs' ordnet viele textreiche Gruppen (Kinderturnen).
* $groupsInDash bool (optional) — nur für SCHLICHTE Gruppen (ohne intro/details): zieht die
* Gruppen-Karten als volle Bodenreihe MIT INS Bento-Dashboard, ohne eigene Sektion
* und ohne „Unsere Gruppen"-Überschrift. Für Disziplinen mit wenigen kurzen Gruppen
* (Trampolin), damit das Dashboard ein zusammenhängender Block bleibt statt einer
* losgelösten Kartenreihe darunter. Bei beschreibenden Gruppen (Wettkampfturnen,
* Kinderturnen) wirkungslos — die brauchen Platz und ihre eigene Sektion.
* $anchor string (optional, Default 'training')
*
* Eine Gruppe → Trainingszeiten landen als Bento-Kachel im Dashboard.
@@ -54,6 +60,7 @@ $noticeTitle = $noticeTitle ?? '';
$noticeTone = $noticeTone ?? 'info';
$noticeIcon = $noticeIcon ?? 'info-circle';
$footnote = $footnote ?? '';
$groupsInDash = !empty($groupsInDash);
$groups = $groups ?? [];
$location = $location ?? [];
@@ -74,6 +81,9 @@ foreach ($groups as $g) {
}
}
// Schlichte Gruppen direkt ins Dashboard ziehen (nur wenn mehrere und keine „reich").
$groupsInline = $groupsInDash && !$single && !$rich;
$hasVenue = !empty($location['venue']);
$mapsQuery = $hasVenue ? rawurlencode(trim(
($location['venue'] ?? '') . ', '
@@ -160,12 +170,39 @@ $renderCardBody = static function (array $g) use ($renderSession): void {
<?php
};
/**
* Schlichte Gruppen-Karte (Name + Trainingszeiten). Als Closure, weil sie an zwei Stellen
* gebraucht wird: im Raster der eigenen Gruppen-Sektion und — bei $groupsInline — als Kachel
* direkt im Bento-Dashboard.
*/
$renderSimpleCard = static function (array $g) use ($renderSession): void {
?>
<article class="group-card">
<div class="group-card__body">
<div class="group-card__header">
<h3 class="group-card__name"><?= e($g['name']) ?></h3>
<?php if (!empty($g['level'])): ?>
<p class="group-card__level"><?= e($g['level']) ?></p>
<?php endif; ?>
</div>
</div>
<?php if (!empty($g['sessions'])): ?>
<div class="group-card__schedule">
<ul class="schedule-list">
<?php foreach ($g['sessions'] as $s): $renderSession($s); endforeach; ?>
</ul>
</div>
<?php endif; ?>
</article>
<?php
};
$soleSessions = $single ? ($groups[0]['sessions'] ?? []) : [];
$soleNote = $single ? ($groups[0]['note'] ?? '') : '';
?>
<section class="section turnen-dash-section" id="<?= e($anchor) ?>">
<div class="container">
<div class="turnen-dash<?= $single ? ' turnen-dash--single' : '' ?><?= $notice !== '' ? ' turnen-dash--notice' : '' ?>">
<div class="turnen-dash<?= $single ? ' turnen-dash--single' : '' ?><?= $notice !== '' ? ' turnen-dash--notice' : '' ?><?= $groupsInline ? ' turnen-dash--groups' : '' ?>">
<?php if ($notice !== ''): ?>
<?php component('notice', [
'title' => $noticeTitle,
@@ -221,12 +258,20 @@ $soleNote = $single ? ($groups[0]['note'] ?? '') : '';
<a class="btn btn--outline turnen-dash__route" href="https://www.google.com/maps/search/?api=1&amp;query=<?= e($mapsQuery) ?>" target="_blank" rel="noopener">Route planen<span class="visually-hidden"> (öffnet Google Maps in neuem Tab)</span></a>
<span class="bento__deco" aria-hidden="true"><?= icon('geo-alt') ?></span>
</article>
<?php endif; ?>
<?php if ($groupsInline): ?>
<div class="turnen-dash__groups group-list--grid">
<?php foreach ($groups as $g): $renderSimpleCard($g); endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php if ($groupsInline && $footnote !== ''): ?>
<p class="group-list__footnote text-muted"><?= e($footnote) ?></p>
<?php endif; ?>
</div>
</section>
<?php if (!$single): ?>
<?php if (!$single && !$groupsInline): ?>
<section class="section group-list-section<?= $groupsTitleHidden ? ' group-list-section--tight' : '' ?>" id="gruppen">
<div class="container">
<h2 class="group-list__title<?= $groupsTitleHidden ? ' visually-hidden' : '' ?>"><?= e($groupsTitle) ?></h2>
@@ -265,25 +310,7 @@ $soleNote = $single ? ($groups[0]['note'] ?? '') : '';
</div>
<?php else: ?>
<div class="group-list group-list--grid">
<?php foreach ($groups as $g): ?>
<article class="group-card">
<div class="group-card__body">
<div class="group-card__header">
<h3 class="group-card__name"><?= e($g['name']) ?></h3>
<?php if (!empty($g['level'])): ?>
<p class="group-card__level"><?= e($g['level']) ?></p>
<?php endif; ?>
</div>
</div>
<?php if (!empty($g['sessions'])): ?>
<div class="group-card__schedule">
<ul class="schedule-list">
<?php foreach ($g['sessions'] as $s): $renderSession($s); endforeach; ?>
</ul>
</div>
<?php endif; ?>
</article>
<?php endforeach; ?>
<?php foreach ($groups as $g): $renderSimpleCard($g); endforeach; ?>
</div>
<?php endif; ?>
<?php if ($footnote !== ''): ?>

View File

@@ -31,5 +31,6 @@ component('group-schedule', [
'noticeTone' => $d['notice_tone'] ?? 'info',
'noticeIcon' => $d['notice_icon'] ?? 'info-circle',
'groups' => $d['groups'] ?? [],
'groupsInDash' => true,
'footnote' => $d['footnote'] ?? '',
]);