This commit is contained in:
Gogs
2026-07-09 15:03:21 +02:00
parent fb6b92c86c
commit 35e7823cd4
4 changed files with 220 additions and 15 deletions
+2 -2
View File
@@ -6,7 +6,7 @@
"country": "",
"language": "",
"enabled": true,
"favorite": false,
"favorite": true,
"number": 10,
"group": "Österreich"
},
@@ -17,7 +17,7 @@
"country": "",
"language": "",
"enabled": true,
"favorite": false,
"favorite": true,
"number": 20,
"group": "Österreich"
},
+94
View File
@@ -469,3 +469,97 @@
color: var(--muted);
font-size: .95rem;
}
.dashboard-hero {
display: flex;
justify-content: space-between;
align-items: center;
gap: 1rem;
margin-bottom: 1.5rem;
padding: 1.5rem;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 18px;
}
.dashboard-hero h2 {
margin: 0;
font-size: 2rem;
}
.dashboard-hero p {
margin: 0.35rem 0 0;
color: var(--muted);
}
.dashboard-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1.25rem;
}
.dashboard-panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 18px;
padding: 1rem;
}
.dashboard-panel h3 {
margin: 0 0 0.9rem;
}
.dashboard-item {
display: grid;
grid-template-columns: 52px 1fr;
gap: 0.75rem;
align-items: center;
padding: 0.65rem;
border-radius: 12px;
color: var(--text);
text-decoration: none;
}
.dashboard-item:hover {
background: var(--panel-2);
}
.dashboard-item img {
width: 52px;
height: 36px;
object-fit: contain;
background: var(--panel-2);
border: 1px solid var(--border);
border-radius: 0.5rem;
padding: 3px;
}
.dashboard-item strong {
display: block;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dashboard-item span {
display: block;
margin-top: 0.2rem;
color: var(--muted);
font-size: 0.88rem;
}
.empty.compact {
padding: 0.8rem;
font-size: 0.9rem;
}
@media (max-width: 900px) {
.dashboard-grid {
grid-template-columns: 1fr;
}
.dashboard-hero {
align-items: flex-start;
flex-direction: column;
}
}
+123 -12
View File
@@ -1,13 +1,124 @@
<?php if (!$channels): ?>
<div class="empty">
Keine Sender gefunden. Prüfe <code>/opt/tvguide-docker/epg/guide.xml</code>.
</div>
<?php endif; ?>
<?php
require_once __DIR__ . '/../src/Services/LogoService.php';
<?php foreach ($channels as $channelId => $channel): ?>
<?php View::render('channel', [
'channelId' => $channelId,
'channel' => $channel,
'programmes' => $programmes[$channelId] ?? []
]); ?>
<?php endforeach; ?>
$now = new DateTimeImmutable('now', new DateTimeZone('Europe/Vienna'));
$upcoming = [];
$primetime = [];
foreach ($programmes as $channelId => $items) {
$channel = $channels[$channelId] ?? null;
if (!$channel) {
continue;
}
foreach ($items as $p) {
$start = $p['start'];
$stop = $p['stop'];
if ($start >= $now && $start <= $now->modify('+30 minutes')) {
$upcoming[] = [
'channel_id' => $channelId,
'channel' => $channel,
'programme' => $p,
];
}
if ($start->format('Y-m-d') === $now->format('Y-m-d')
&& $start->format('H:i') >= '20:00'
&& $start->format('H:i') <= '23:00') {
$primetime[] = [
'channel_id' => $channelId,
'channel' => $channel,
'programme' => $p,
];
}
}
}
usort($upcoming, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
usort($primetime, fn($a, $b) => $a['programme']['start'] <=> $b['programme']['start']);
$favoritesNow = array_values(array_filter(
$currentProgrammes,
fn($item) => !empty($item['favorite'])
));
?>
<section class="dashboard-hero">
<div>
<h2>TVGuide</h2>
<p>Dein Überblick für jetzt, gleich und heute Abend.</p>
</div>
<a class="button-link" href="/?view=day">Tagesansicht öffnen</a>
</section>
<div class="dashboard-grid">
<section class="dashboard-panel">
<h3>🔥 Jetzt läuft</h3>
<?php foreach (array_slice($currentProgrammes, 0, 6) as $item): ?>
<a class="dashboard-item" href="/?view=now">
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
<div>
<strong><?= htmlspecialchars($item['title']) ?></strong>
<span><?= htmlspecialchars($item['channel_name']) ?> · noch <?= (int)$item['remaining_minutes'] ?> Min.</span>
</div>
</a>
<?php endforeach; ?>
</section>
<section class="dashboard-panel">
<h3>⏰ Beginnt gleich</h3>
<?php foreach (array_slice($upcoming, 0, 6) as $item): ?>
<a class="dashboard-item" href="/?view=day">
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
<div>
<strong><?= htmlspecialchars($item['programme']['title']) ?></strong>
<span><?= $item['programme']['start']->format('H:i') ?> · <?= htmlspecialchars($item['channel']['name']) ?></span>
</div>
</a>
<?php endforeach; ?>
<?php if (!$upcoming): ?>
<div class="empty compact">In den nächsten 30 Minuten beginnt keine Sendung.</div>
<?php endif; ?>
</section>
<section class="dashboard-panel">
<h3>⭐ Favoriten jetzt</h3>
<?php foreach (array_slice($favoritesNow, 0, 6) as $item): ?>
<a class="dashboard-item" href="/?view=favorites">
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
<div>
<strong><?= htmlspecialchars($item['title']) ?></strong>
<span><?= htmlspecialchars($item['channel_name']) ?> · <?= (int)$item['percent'] ?>%</span>
</div>
</a>
<?php endforeach; ?>
<?php if (!$favoritesNow): ?>
<div class="empty compact">Aktuell läuft auf deinen Favoriten nichts.</div>
<?php endif; ?>
</section>
<section class="dashboard-panel">
<h3>📺 Heute Abend</h3>
<?php foreach (array_slice($primetime, 0, 8) as $item): ?>
<a class="dashboard-item" href="/?view=day">
<img src="<?= htmlspecialchars(LogoService::getLogoUrl($item['channel_id'])) ?>" alt="">
<div>
<strong><?= htmlspecialchars($item['programme']['title']) ?></strong>
<span><?= $item['programme']['start']->format('H:i') ?> · <?= htmlspecialchars($item['channel']['name']) ?></span>
</div>
</a>
<?php endforeach; ?>
<?php if (!$primetime): ?>
<div class="empty compact">Für heute Abend wurden keine Sendungen gefunden.</div>
<?php endif; ?>
</section>
</div>
+1 -1
View File
@@ -21,7 +21,7 @@ $isFavoritesView = ($view ?? '') === 'favorites';
</div>
<?php endif; ?>
<div class="now-grid now-grid-enhanced" data-live-now-grid>
<div class="now-grid now-grid-enhanced" <?= !$isFavoritesView ? 'data-live-now-grid' : '' ?>>
<?php foreach ($currentProgrammes as $item): ?>
<?php
$logoUrl = LogoService::getLogoUrl($item['channel_id']);