Matchcenter: Spielplan, Ergebnisse & Tabellen (eigene Seite statt BFV-Widget)
Neue Unterseite /matchcenter ersetzt die alten BFV-Widget-Embeds (verstoßen
gegen CSP) durch eine self-hostete Lösung: Cron-Scraper holt die Daten aus der
öffentlichen BFV-Widget-JSON-API, schreibt data/matchcenter.json und lädt die
Vereinswappen lokal — Besucher kontaktieren nur unsere Domain.
- bin/matchcenter-sync.php: CLI/Cron-Scraper (Muster wie instagram-sync), JSON-API
team/{id}/matches + competition/{compoundId}/table, Wappen via getLogo lokal,
atomarer Write, Fail-safe. Auto-Saison: Tabellen-compoundId wird aus der
Matches-API abgeleitet (team_id ist saison-stabil). Per-Team-Cache-Fallback bei
Fetch-Fehlern, damit Sektionen nie leeren.
- Seite app/pages/matchcenter.php + Route + Nav-Eintrag (unter Fußball).
- Komponenten: match-slider (nächste Spiele), match-card, match-row, league-table
(mit Auf-/Abstiegszonen), matchcenter-section (kicker-Layout: Tabelle 2/3 +
Spiele 1/3), matchcenter-empty, crest (weißes Chip + Initialen-Fallback).
- carousel.js: banner.js zum generischen [data-carousel]-Antrieb verallgemeinert
(Banner- und Match-Slider teilen ihn); crest.js: Logo-Fallback im Browser.
- helpers.php: sportsevent_nodes() für SportsEvent-JSON-LD.
- Icons calendar-event; config.example + .gitignore + CLAUDE.md ergänzt.
- Responsive geprüft (kein Seiten-Overflow 360–1280, Tabelle scrollt in der Karte).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0192vTfGmGpoWeyUse4TuQFj
This commit is contained in:
60
app/components/matchcenter-section.php
Normal file
60
app/components/matchcenter-section.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* Matchcenter-Sektion einer Mannschaft (kicker-Stil): Kopf (Name + Liga + Link zur
|
||||
* Mannschaftsseite), darunter zweispaltig — Tabelle 2/3 links, anstehende Spiele +
|
||||
* letzte Ergebnisse als kompakte Liste 1/3 rechts. Auf schmalen Screens gestapelt.
|
||||
* Props: $team (data/matchcenter.json → teams[]). Leere Blöcke verstecken sich selbst.
|
||||
*/
|
||||
$team = $team ?? [];
|
||||
$next = $team['next_matches'] ?? [];
|
||||
$results = $team['last_results'] ?? [];
|
||||
$table = $team['table'] ?? [];
|
||||
$league = $team['league'] ?? null;
|
||||
$key = preg_replace('/[^a-z0-9-]+/', '', strtolower((string) ($team['key'] ?? '')));
|
||||
?>
|
||||
<section class="section matchcenter-team" id="team-<?= e($key) ?>">
|
||||
<div class="container">
|
||||
<div class="matchcenter-team__head">
|
||||
<div class="matchcenter-team__heading">
|
||||
<h2><?= e($team['name'] ?? '') ?></h2>
|
||||
<?php if ($league): ?>
|
||||
<p class="matchcenter-team__league"><?= icon('trophy', 'matchcenter-team__league-icon') ?><?= e($league) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!empty($team['slug'])): ?>
|
||||
<a class="btn btn--outline" href="<?= e(url($team['slug'])) ?>">Zur Mannschaft</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="matchcenter-team__grid">
|
||||
<?php if ($table !== []): ?>
|
||||
<div class="matchcenter-team__main">
|
||||
<?php /* Sichtbare Überschrift bewusst weggelassen; <caption> labelt die Tabelle für Screenreader. */ ?>
|
||||
<?php component('league-table', ['table' => $table, 'caption' => 'Tabelle ' . ($team['name'] ?? '') . ($league ? ' · ' . $league : '')]); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($next !== [] || $results !== []): ?>
|
||||
<aside class="matchcenter-team__aside">
|
||||
<?php if ($next !== []): ?>
|
||||
<h3 class="visually-hidden">Nächste Spiele</h3>
|
||||
<ul class="match-list">
|
||||
<?php foreach ($next as $m): ?>
|
||||
<?php component('match-row', ['match' => $m]); ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php if ($results !== []): ?>
|
||||
<h3 class="visually-hidden">Letzte Ergebnisse</h3>
|
||||
<ul class="match-list">
|
||||
<?php foreach ($results as $m): ?>
|
||||
<?php component('match-row', ['match' => $m]); ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</aside>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user