Add app layout with sidebar and header
This commit is contained in:
+199
-43
@@ -1,89 +1,245 @@
|
||||
:root {
|
||||
--bg: #0f172a;
|
||||
--panel: #111827;
|
||||
--panel-2: #1f2937;
|
||||
--panel-3: #273244;
|
||||
--border: #334155;
|
||||
--text: #f8fafc;
|
||||
--muted: #94a3b8;
|
||||
--accent: #3b82f6;
|
||||
--accent-soft: rgba(59, 130, 246, 0.16);
|
||||
--success: #22c55e;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: system-ui, sans-serif;
|
||||
background: #101114;
|
||||
color: #eee;
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
}
|
||||
|
||||
.topbar {
|
||||
padding: 20px;
|
||||
background: #181a20;
|
||||
border-bottom: 1px solid #2b2f3a;
|
||||
.app-shell {
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
grid-template-columns: 230px 1fr;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
background: #0b1120;
|
||||
border-right: 1px solid var(--border);
|
||||
padding: 24px 16px;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.sidebar-nav a {
|
||||
color: var(--muted);
|
||||
text-decoration: none;
|
||||
padding: 12px 14px;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sidebar-nav a:hover,
|
||||
.sidebar-nav a.active {
|
||||
color: var(--text);
|
||||
background: var(--accent-soft);
|
||||
}
|
||||
|
||||
.app-main {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
height: 82px;
|
||||
background: var(--panel);
|
||||
border-bottom: 1px solid var(--border);
|
||||
padding: 16px 28px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 28px;
|
||||
justify-content: space-between;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.topbar h1 {
|
||||
margin: 0;
|
||||
.brand-title {
|
||||
font-size: 1.45rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.topbar nav {
|
||||
display: flex;
|
||||
gap: 14px;
|
||||
.brand-subtitle {
|
||||
color: var(--muted);
|
||||
font-size: 0.85rem;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.topbar a {
|
||||
color: #cfd6e6;
|
||||
text-decoration: none;
|
||||
.search-box input {
|
||||
width: min(360px, 40vw);
|
||||
background: #020617;
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 999px;
|
||||
padding: 10px 16px;
|
||||
}
|
||||
|
||||
main {
|
||||
padding: 20px;
|
||||
max-width: 1100px;
|
||||
margin: 0 auto;
|
||||
.content {
|
||||
padding: 32px;
|
||||
max-width: 1280px;
|
||||
}
|
||||
|
||||
.channel {
|
||||
margin-bottom: 28px;
|
||||
background: #181a20;
|
||||
border: 1px solid #2b2f3a;
|
||||
border-radius: 16px;
|
||||
margin-bottom: 24px;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 18px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.channel-header {
|
||||
padding: 14px 18px;
|
||||
background: #20232c;
|
||||
font-size: 1.25rem;
|
||||
font-weight: 700;
|
||||
padding: 16px 20px;
|
||||
background: var(--panel-2);
|
||||
font-size: 1.2rem;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.programme {
|
||||
padding: 14px 18px;
|
||||
border-top: 1px solid #2b2f3a;
|
||||
padding: 16px 20px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.programme-time {
|
||||
color: #9da7bd;
|
||||
color: var(--muted);
|
||||
font-size: 0.95rem;
|
||||
margin-bottom: 4px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.programme-title {
|
||||
font-size: 1.1rem;
|
||||
font-weight: 700;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.programme-desc {
|
||||
color: #c9ced8;
|
||||
margin-top: 6px;
|
||||
color: #cbd5e1;
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.category {
|
||||
display: inline-block;
|
||||
margin-top: 8px;
|
||||
padding: 3px 8px;
|
||||
margin-top: 10px;
|
||||
padding: 4px 9px;
|
||||
border-radius: 999px;
|
||||
background: #303545;
|
||||
color: #cfd6e6;
|
||||
background: var(--panel-3);
|
||||
color: #dbeafe;
|
||||
font-size: 0.8rem;
|
||||
}
|
||||
|
||||
.empty {
|
||||
color: #aaa;
|
||||
background: #181a20;
|
||||
border: 1px solid #2b2f3a;
|
||||
.empty,
|
||||
.notice {
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
padding: 18px;
|
||||
}
|
||||
|
||||
.notice {
|
||||
border-color: #15803d;
|
||||
background: rgba(34, 197, 94, 0.12);
|
||||
color: #dcfce7;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
button {
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: 0;
|
||||
border-radius: 10px;
|
||||
padding: 10px 16px;
|
||||
font-weight: 800;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.settings-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.settings-header h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.channels-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: var(--panel);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 16px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.channels-table th,
|
||||
.channels-table td {
|
||||
padding: 12px;
|
||||
border-bottom: 1px solid var(--border);
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.channels-table th {
|
||||
background: var(--panel-2);
|
||||
color: #cbd5e1;
|
||||
}
|
||||
|
||||
.channels-table input[type="text"],
|
||||
.channels-table input[type="number"] {
|
||||
background: #020617;
|
||||
color: var(--text);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
padding: 7px 9px;
|
||||
}
|
||||
|
||||
.number-input {
|
||||
width: 70px;
|
||||
}
|
||||
|
||||
.channel-id {
|
||||
color: var(--muted);
|
||||
font-size: 0.8rem;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.app-shell {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
border-right: 0;
|
||||
border-bottom: 1px solid var(--border);
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
flex-direction: row;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.app-header {
|
||||
padding: 14px 20px;
|
||||
}
|
||||
|
||||
.search-box input {
|
||||
width: 160px;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-6
@@ -1,10 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once '/var/www/vendor/autoload.php';
|
||||
|
||||
use TVGuide\Config;
|
||||
use TVGuide\XmlTv;
|
||||
use TVGuide\View;
|
||||
require_once '/var/www/src/Config.php';
|
||||
require_once '/var/www/src/XmlTv.php';
|
||||
require_once '/var/www/src/View.php';
|
||||
|
||||
$config = new Config(
|
||||
'/var/www/config/config.json',
|
||||
@@ -18,13 +16,42 @@ $xmltv = new XmlTv(
|
||||
|
||||
$xmltv->synchronizeChannels($config);
|
||||
|
||||
$view = $_GET['view'] ?? $config->get('default_view', 'today');
|
||||
|
||||
if ($view === 'channels' && $_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$savedChannels = $config->getChannels();
|
||||
|
||||
foreach ($savedChannels as $id => &$channel) {
|
||||
$channel['enabled'] = isset($_POST['enabled'][$id]);
|
||||
$channel['favorite'] = isset($_POST['favorite'][$id]);
|
||||
$channel['number'] = (int)($_POST['number'][$id] ?? $channel['number'] ?? 999999);
|
||||
$channel['group'] = trim($_POST['group'][$id] ?? $channel['group'] ?? 'Unknown');
|
||||
}
|
||||
|
||||
unset($channel);
|
||||
|
||||
uasort($savedChannels, function ($a, $b) {
|
||||
return ((int)($a['number'] ?? 999999)) <=> ((int)($b['number'] ?? 999999));
|
||||
});
|
||||
|
||||
$config->saveChannels($savedChannels);
|
||||
|
||||
header('Location: /?view=channels&saved=1');
|
||||
exit;
|
||||
}
|
||||
|
||||
[$channels, $programmes] = $xmltv->load($config);
|
||||
|
||||
$contentTemplate = '/var/www/templates/home.php';
|
||||
$contentTemplate = $view === 'channels'
|
||||
? '/var/www/templates/channels.php'
|
||||
: '/var/www/templates/home.php';
|
||||
|
||||
View::render('layout', [
|
||||
'title' => $config->get('title', 'TVGuide'),
|
||||
'channels' => $channels,
|
||||
'programmes' => $programmes,
|
||||
'contentTemplate' => $contentTemplate,
|
||||
'view' => $view,
|
||||
'channelConfig' => $config->getChannels(),
|
||||
'saved' => isset($_GET['saved']),
|
||||
]);
|
||||
|
||||
+1
-11
@@ -1,10 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace TVGuide;
|
||||
|
||||
use DateTime;
|
||||
use DateTimeZone;
|
||||
|
||||
class Config
|
||||
{
|
||||
private array $config = [];
|
||||
@@ -35,14 +30,9 @@ class Config
|
||||
|
||||
public function saveChannels(array $channels): void
|
||||
{
|
||||
$this->channels = $channels;
|
||||
|
||||
file_put_contents(
|
||||
'/var/www/config/channels.json',
|
||||
json_encode(
|
||||
$channels,
|
||||
JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE
|
||||
)
|
||||
json_encode($channels, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace TVGuide;
|
||||
|
||||
class View
|
||||
{
|
||||
public static function render(string $template, array $data = []): void
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<?php foreach ($programmes as $p): ?>
|
||||
<?php \TVGuide\View::render('programme', ['p' => $p]); ?>
|
||||
<?php View::render('programme', ['p' => $p]); ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</section>
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php if ($saved): ?>
|
||||
<div class="notice">Sender gespeichert.</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form method="post" class="settings-form">
|
||||
<div class="settings-header">
|
||||
<h2>Senderverwaltung</h2>
|
||||
<button type="submit">Speichern</button>
|
||||
</div>
|
||||
|
||||
<table class="channels-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nr.</th>
|
||||
<th>Aktiv</th>
|
||||
<th>Favorit</th>
|
||||
<th>Sender</th>
|
||||
<th>Gruppe</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($channelConfig as $id => $channel): ?>
|
||||
<tr>
|
||||
<td>
|
||||
<input class="number-input" type="number" name="number[<?= htmlspecialchars($id) ?>]" value="<?= (int)($channel['number'] ?? 999999) ?>">
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="enabled[<?= htmlspecialchars($id) ?>]" <?= !empty($channel['enabled']) ? 'checked' : '' ?>>
|
||||
</td>
|
||||
<td>
|
||||
<input type="checkbox" name="favorite[<?= htmlspecialchars($id) ?>]" <?= !empty($channel['favorite']) ? 'checked' : '' ?>>
|
||||
</td>
|
||||
<td>
|
||||
<strong><?= htmlspecialchars($channel['name'] ?? $id) ?></strong>
|
||||
<div class="channel-id"><?= htmlspecialchars($id) ?></div>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="group[<?= htmlspecialchars($id) ?>]" value="<?= htmlspecialchars($channel['group'] ?? 'Unknown') ?>">
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
@@ -0,0 +1,10 @@
|
||||
<header class="app-header">
|
||||
<div class="brand">
|
||||
<div class="brand-title">TVGuide</div>
|
||||
<div class="brand-subtitle">tv.windesign.at</div>
|
||||
</div>
|
||||
|
||||
<div class="search-box">
|
||||
<input type="search" placeholder="Suchen..." disabled>
|
||||
</div>
|
||||
</header>
|
||||
@@ -5,7 +5,7 @@
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($channels as $channelId => $channel): ?>
|
||||
<?php \TVGuide\View::render('channel', [
|
||||
<?php View::render('channel', [
|
||||
'channelId' => $channelId,
|
||||
'channel' => $channel,
|
||||
'programmes' => $programmes[$channelId] ?? []
|
||||
|
||||
+10
-11
@@ -7,18 +7,17 @@
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<header class="topbar">
|
||||
<h1>TVGuide</h1>
|
||||
<nav>
|
||||
<a href="/">Heute</a>
|
||||
<a href="/?view=now">Jetzt</a>
|
||||
<a href="/?view=primetime">20:15</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="app-shell">
|
||||
<?php require '/var/www/templates/sidebar.php'; ?>
|
||||
|
||||
<main>
|
||||
<?php require $contentTemplate; ?>
|
||||
</main>
|
||||
<div class="app-main">
|
||||
<?php require '/var/www/templates/header.php'; ?>
|
||||
|
||||
<main class="content">
|
||||
<?php require $contentTemplate; ?>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/assets/js/app.js"></script>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<aside class="sidebar">
|
||||
<nav class="sidebar-nav">
|
||||
<a href="/" class="<?= ($view ?? '') === 'today' ? 'active' : '' ?>">🏠 Heute</a>
|
||||
<a href="/?view=now" class="<?= ($view ?? '') === 'now' ? 'active' : '' ?>">▶ Jetzt</a>
|
||||
<a href="/?view=favorites" class="<?= ($view ?? '') === 'favorites' ? 'active' : '' ?>">⭐ Favoriten</a>
|
||||
<a href="/?view=channels" class="<?= ($view ?? '') === 'channels' ? 'active' : '' ?>">📺 Sender</a>
|
||||
<a href="/?view=settings" class="<?= ($view ?? '') === 'settings' ? 'active' : '' ?>">⚙ Einstellungen</a>
|
||||
</nav>
|
||||
</aside>
|
||||
@@ -0,0 +1,6 @@
|
||||
# Gitea SSH
|
||||
|
||||
Wenn der Linux-Benutzer `git` ein anderes Home-Verzeichnis als `/home/git` besitzt (z. B. `/var/opt/gitlab`), muss in `app.ini` Folgendes gesetzt werden:
|
||||
|
||||
```ini
|
||||
SSH_ROOT_PATH = /var/opt/gitlab/.ssh
|
||||
Reference in New Issue
Block a user