71 lines
3.3 KiB
PHP
71 lines
3.3 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Aufmacher des „Nächste Spiele"-Bands: das zeitlich nächste Spiel — strukturgleich
|
||
|
|
* mit match-row (Heim über Gast, linksbündig), nur groß. Ein Bauprinzip für das
|
||
|
|
* ganze Band; die Wirkung kommt aus der Größe, nicht aus Badges oder Icons.
|
||
|
|
* Drei Schriftrollen: Meta-Zeile (Abel, gesperrt) · Vereinsnamen (Coolvetica) ·
|
||
|
|
* Anstoßzeile (Abel). Props:
|
||
|
|
* $match Eintrag aus data/matchcenter.json → upcoming[]
|
||
|
|
* $team_name Name der eigenen Mannschaft („1. Mannschaft")
|
||
|
|
* $league Liganame der Mannschaft (für die Meta-Zeile)
|
||
|
|
* $href Sprungmarke zur Mannschafts-Sektion (optional; macht den
|
||
|
|
* Mannschaftsnamen in der Meta-Zeile zum Link)
|
||
|
|
*/
|
||
|
|
$m = $match;
|
||
|
|
$isHome = !empty($m['is_home']);
|
||
|
|
$teamName = (string) ($team_name ?? '');
|
||
|
|
$league = (string) ($league ?? '');
|
||
|
|
$href = $href ?? null;
|
||
|
|
$when = match_when((string) ($m['kickoff'] ?? ''));
|
||
|
|
|
||
|
|
// Meta-Zeile: Mannschaft · Wettbewerb · Heim/Auswärts (leere Teile fallen weg).
|
||
|
|
$competition = match_competition_label((string) ($m['competition'] ?? ''), $league);
|
||
|
|
$meta = array_values(array_filter([
|
||
|
|
$teamName,
|
||
|
|
$competition,
|
||
|
|
$isHome ? 'Heimspiel' : 'Auswärtsspiel',
|
||
|
|
], static fn (string $part): bool => $part !== ''));
|
||
|
|
|
||
|
|
$datetime = trim(($m['date_display'] ?? '') . ' · ' . ($m['time_display'] ?? ''), ' ·');
|
||
|
|
?>
|
||
|
|
<article class="match-feature">
|
||
|
|
<?php if ($meta !== []): ?>
|
||
|
|
<p class="match-feature__meta">
|
||
|
|
<?php foreach ($meta as $i => $part): ?>
|
||
|
|
<?php if ($i > 0): ?>
|
||
|
|
<span class="match-feature__sep" aria-hidden="true">·</span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($i === 0 && $href !== null): ?>
|
||
|
|
<a href="<?= e($href) ?>"><?= e($part) ?></a>
|
||
|
|
<?php else: ?>
|
||
|
|
<span><?= e($part) ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php endforeach; ?>
|
||
|
|
</p>
|
||
|
|
<?php endif; ?>
|
||
|
|
<div class="match-feature__fixture">
|
||
|
|
<span class="match-feature__side<?= $isHome ? ' is-own' : '' ?>">
|
||
|
|
<?php component('crest', ['src' => $m['home_crest'] ?? null, 'name' => $m['home'] ?? '']); ?>
|
||
|
|
<span class="match-feature__club"><?= e($m['home'] ?? '') ?></span>
|
||
|
|
</span>
|
||
|
|
<span class="match-feature__side<?= !$isHome ? ' is-own' : '' ?>">
|
||
|
|
<?php component('crest', ['src' => $m['away_crest'] ?? null, 'name' => $m['away'] ?? '']); ?>
|
||
|
|
<span class="match-feature__club"><?= e($m['away'] ?? '') ?></span>
|
||
|
|
</span>
|
||
|
|
</div>
|
||
|
|
<p class="match-feature__when">
|
||
|
|
<?php if ($when['iso'] !== ''): ?>
|
||
|
|
<time datetime="<?= e($when['iso']) ?>"><?= e($datetime) ?></time>
|
||
|
|
<?php else: ?>
|
||
|
|
<span><?= e($datetime) ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
<?php if ($when['countdown'] !== ''): ?>
|
||
|
|
<span class="match-feature__sep" aria-hidden="true">·</span>
|
||
|
|
<span class="match-feature__countdown" data-countdown="<?= e($when['iso']) ?>"><?= e($when['countdown']) ?></span>
|
||
|
|
<?php endif; ?>
|
||
|
|
</p>
|
||
|
|
</article>
|