fix: Magazine card wasn't working.
This commit is contained in:
+41
-11
@@ -136,6 +136,16 @@ function export_programme_is_series(array $programme): bool {
|
||||
return !empty($programme['subtitle']);
|
||||
}
|
||||
|
||||
function export_programme_has_category(array $programme, array $needles): bool {
|
||||
foreach ($programme['categories'] as $category) {
|
||||
$value = strtolower($category);
|
||||
foreach ($needles as $needle) {
|
||||
if (str_contains($value, strtolower($needle))) return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function export_take_entries(array $entries, callable $filter, int $limit = 4): array {
|
||||
$picked = [];
|
||||
foreach ($entries as $entry) {
|
||||
@@ -169,6 +179,7 @@ function export_build_magazine(array $channels): array {
|
||||
$series = export_take_entries($all, static fn($entry) => export_programme_is_series($entry['programme']), 4);
|
||||
$movies = export_take_entries($all, static fn($entry) => !export_programme_is_series($entry['programme']) && export_programme_duration($entry['programme']) >= 80, 4);
|
||||
$late_picks = export_take_entries($all, static fn($entry) => (int) $entry['programme']['start']->format('H') >= 21, 4);
|
||||
$docs = export_take_entries($all, static fn($entry) => export_programme_has_category($entry['programme'], ['document', 'biopic', 'history', 'histoire']), 4);
|
||||
|
||||
$by_channel = [];
|
||||
foreach ($channels as $channel) {
|
||||
@@ -181,24 +192,24 @@ function export_build_magazine(array $channels): array {
|
||||
|
||||
$cards = [
|
||||
[
|
||||
'title' => 'A ne pas manquer',
|
||||
'title' => 'Ce soir a la tele',
|
||||
'kicker' => 'Selection de la redaction',
|
||||
'items' => array_slice($highlights, 0, 4),
|
||||
],
|
||||
[
|
||||
'title' => 'Series en diffusion',
|
||||
'kicker' => 'Nouvelle serie diffusee',
|
||||
'kicker' => 'Episodes et rendez-vous',
|
||||
'items' => $series ?: array_slice($highlights, 0, 4),
|
||||
],
|
||||
[
|
||||
'title' => 'Grands formats',
|
||||
'kicker' => 'Films et longs formats',
|
||||
'title' => 'Films de la selection',
|
||||
'kicker' => 'Longs formats',
|
||||
'items' => $movies ?: array_slice($highlights, 0, 4),
|
||||
],
|
||||
[
|
||||
'title' => 'Nouveautes du soir',
|
||||
'kicker' => 'Prime time',
|
||||
'items' => $late_picks ?: array_slice($highlights, 0, 4),
|
||||
'title' => 'Docs et recits de vie',
|
||||
'kicker' => 'Documentaires / biopics',
|
||||
'items' => $docs ?: $late_picks ?: array_slice($highlights, 0, 4),
|
||||
],
|
||||
];
|
||||
|
||||
@@ -279,11 +290,16 @@ $magazine = export_build_magazine($visible_channels);
|
||||
.prog-title{font-size:16px;font-weight:700;line-height:1.08}
|
||||
.prog-sub,.prog-cats,.prog-desc{font-size:12px;color:var(--ink-soft);line-height:1.3;margin-top:2px}
|
||||
.prog-desc{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
|
||||
.magazine{display:grid;gap:18px}
|
||||
.magazine{display:grid;gap:20px}
|
||||
.mag-banner{display:grid;grid-template-columns:1.1fr .9fr;gap:18px;background:linear-gradient(135deg,#8b2d20 0,#4c2019 60%,#1f1a17 100%);color:#f7efe3;padding:18px;border:1px solid rgba(255,255,255,.14)}
|
||||
.mag-banner-title{font-family:'IM Fell English',serif;font-size:48px;line-height:1.02;margin:0 0 8px}
|
||||
.mag-banner-sub{font-size:15px;line-height:1.45;color:#f0dcca;max-width:540px}
|
||||
.mag-banner-meta{display:flex;gap:10px;flex-wrap:wrap;align-content:flex-start;justify-content:flex-end}
|
||||
.mag-banner-meta span{border:1px solid rgba(255,255,255,.22);padding:7px 10px;font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.08em;text-transform:uppercase}
|
||||
.mag-hero{display:grid;grid-template-columns:1.3fr .9fr;gap:18px}
|
||||
.mag-lead,.mag-side,.mag-channel{background:rgba(255,255,255,.35);border:1px solid var(--line);padding:16px}
|
||||
.mag-kicker{font-family:'Share Tech Mono',monospace;font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--accent-2);margin-bottom:8px}
|
||||
.mag-title{font-family:'IM Fell English',serif;font-size:34px;line-height:1.02;margin-bottom:10px}
|
||||
.mag-title{font-family:'IM Fell English',serif;font-size:38px;line-height:1.02;margin-bottom:10px}
|
||||
.mag-meta{font-family:'Share Tech Mono',monospace;font-size:11px;color:var(--ink-soft);letter-spacing:.04em;margin-bottom:10px}
|
||||
.mag-desc{font-size:14px;line-height:1.45;color:var(--ink-soft)}
|
||||
.mag-side-list,.mag-channels,.mag-cards{display:grid;gap:14px}
|
||||
@@ -301,6 +317,7 @@ $magazine = export_build_magazine($visible_channels);
|
||||
.mag-item-title{font-size:15px;font-weight:700;line-height:1.08}
|
||||
.mag-card{background:rgba(255,255,255,.35);border:1px solid var(--line);padding:14px}
|
||||
.mag-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
|
||||
.mag-card.featured{background:linear-gradient(180deg,rgba(170,66,49,.12),rgba(255,255,255,.35))}
|
||||
.timeline-wrap{display:grid;gap:14px}
|
||||
.timeline-row{display:grid;grid-template-columns:180px 1fr;gap:14px;align-items:stretch}
|
||||
.timeline-channel{border-top:2px solid var(--accent-2);padding-top:8px}
|
||||
@@ -312,7 +329,7 @@ $magazine = export_build_magazine($visible_channels);
|
||||
.mini-title{font-size:13px;font-weight:700;line-height:1.05}
|
||||
.mini-meta{font-family:'Share Tech Mono',monospace;font-size:10px;color:var(--ink-soft);margin-top:3px}
|
||||
@media print{body{background:#fff}.page{padding:0}.toolbar{display:none}.sheet{box-shadow:none;border:none;width:auto;margin:0}.sheet-wrap{overflow:visible}.cards-grid{grid-template-columns:1fr 1fr}}
|
||||
@media (max-width:1200px){.sheet{width:100%}.cards-grid,.mag-channels,.mag-hero,.mag-cards{grid-template-columns:1fr}.timeline-row{grid-template-columns:1fr}.timeline-grid{overflow:auto}}
|
||||
@media (max-width:1200px){.sheet{width:100%}.cards-grid,.mag-channels,.mag-hero,.mag-cards,.mag-banner{grid-template-columns:1fr}.timeline-row{grid-template-columns:1fr}.timeline-grid{overflow:auto}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -448,6 +465,19 @@ $items = array_values(array_filter($channel['programmes'], static fn($p) => $p['
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="magazine">
|
||||
<section class="mag-banner">
|
||||
<div>
|
||||
<div class="mag-kicker" style="color:#f0dcca">Supplement TV</div>
|
||||
<div class="mag-banner-title">Le magazine de la soiree</div>
|
||||
<div class="mag-banner-sub">Une version plus editoriale de la grille, pensee comme un vrai programme tele: les temps forts, les series a suivre, les films du soir et une selection par chaine.</div>
|
||||
</div>
|
||||
<div class="mag-banner-meta">
|
||||
<span><?= htmlspecialchars($window['label']) ?></span>
|
||||
<span><?= count($visible_channels) ?> chaines</span>
|
||||
<span><?= htmlspecialchars($source['name'] ?? 'Source') ?></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="mag-hero">
|
||||
<section class="mag-lead">
|
||||
<div class="mag-kicker">Cover story</div>
|
||||
@@ -501,7 +531,7 @@ $items = array_values(array_filter($channel['programmes'], static fn($p) => $p['
|
||||
<div class="mag-kicker">Magazine cards</div>
|
||||
<div class="mag-cards">
|
||||
<?php foreach ($magazine['cards'] as $card): ?>
|
||||
<section class="mag-card">
|
||||
<section class="mag-card<?= $card === $magazine['cards'][0] ? ' featured' : '' ?>">
|
||||
<div class="mag-kicker"><?= htmlspecialchars($card['kicker']) ?></div>
|
||||
<div class="mag-mini-title" style="margin-bottom:10px"><?= htmlspecialchars($card['title']) ?></div>
|
||||
<?php foreach ($card['items'] as $entry): $p = $entry['programme']; ?>
|
||||
|
||||
Reference in New Issue
Block a user