Reorganize repo layout

This commit is contained in:
2026-02-02 23:57:09 +01:00
parent 421fc78cc4
commit 4c15f0685c
13 changed files with 53 additions and 23 deletions

244
web/public/index.php Normal file
View File

@@ -0,0 +1,244 @@
<?php
session_start();
/**
* Routing (Demo)
* s = section (Hauptmenü)
* p = page/sub (Kontextmenü)
* planet = aktive Kolonie
*/
$section = $_GET['s'] ?? 'overview';
$sub = $_GET['p'] ?? null;
$planet = $_GET['planet'] ?? 'earth';
// Demo Alert/Toast triggers
if (($_GET['toast'] ?? '') === 'ok') {
$_SESSION['flash_toast'][] = ['type' => 'success', 'title' => 'Mission Update', 'message' => 'Daten erfolgreich gespeichert.'];
header("Location: index.php?s=$section&p=" . urlencode((string)$sub) . "&planet=$planet");
exit;
}
if (($_GET['toast'] ?? '') === 'err') {
$_SESSION['flash_error'] = "Bitte alle Pflichtfelder ausfüllen (Hyperdrive-Parameter fehlen).";
$_SESSION['flash_toast'][] = ['type' => 'error', 'title' => 'System Alert', 'message' => 'Eingabe unvollständig überprüfe die Felder.'];
header("Location: index.php?s=$section&p=" . urlencode((string)$sub) . "&planet=$planet");
exit;
}
// Alertbar nur wenn Fehler vorhanden
$errorMessage = $_SESSION['flash_error'] ?? null;
unset($_SESSION['flash_error']);
// Toasts (Flash)
$toasts = $_SESSION['flash_toast'] ?? [];
unset($_SESSION['flash_toast']);
// Kontextmenü-Definitionen (Subnav in der Mitte)
$subnav = [
'overview' => [['key'=>'dashboard','label'=>'Übersicht'], ['key'=>'events','label'=>'Events'], ['key'=>'queues','label'=>'Queues']],
'build' => [['key'=>'build','label'=>'Bauen'], ['key'=>'demolish','label'=>'Abreißen']],
'research' => [['key'=>'list','label'=>'Forschungen'], ['key'=>'tree','label'=>'Forschungstree']],
'shipyard' => [['key'=>'small','label'=>'Klein'], ['key'=>'medium','label'=>'Mittel'], ['key'=>'large','label'=>'Groß']],
'fleet' => [['key'=>'send','label'=>'Versenden'], ['key'=>'missions','label'=>'Missionen'], ['key'=>'scrap','label'=>'Verschrotten']],
'messages' => [['key'=>'inbox','label'=>'Posteingang'], ['key'=>'outbox','label'=>'Ausgang'], ['key'=>'addressbook','label'=>'Adressbuch']],
'reports' => [['key'=>'combat','label'=>'Kampfberichte'], ['key'=>'spy','label'=>'Spionage'], ['key'=>'archive','label'=>'Archiv']],
'galaxy' => [['key'=>'view','label'=>'Galaxy View'], ['key'=>'bookmark','label'=>'Lesezeichen'], ['key'=>'scan','label'=>'Scan']],
'stargate' => [['key'=>'overview','label'=>'Übersicht'], ['key'=>'links','label'=>'Verbindungen'], ['key'=>'log','label'=>'Protokoll']],
'pod' => [['key'=>'pad','label'=>'Abschussrampe'], ['key'=>'production','label'=>'Produktion']],
'trade' => [['key'=>'hub','label'=>'Handelszentrum'], ['key'=>'market','label'=>'Börsenkurse']],
'blackmarket' => [['key'=>'overview','label'=>'Übersicht'], ['key'=>'create','label'=>'Inserieren'], ['key'=>'mine','label'=>'Meine Inserate']],
'bank' => [['key'=>'overview','label'=>'Übersicht'], ['key'=>'transfer','label'=>'Überweisung'], ['key'=>'accounts','label'=>'Konten hinzufügen']],
'terraformer' => [['key'=>'overview','label'=>'Übersicht']],
'settings' => [['key'=>'ui','label'=>'UI'], ['key'=>'performance','label'=>'Performance'], ['key'=>'alerts','label'=>'Alerts'], ['key'=>'account','label'=>'Account']],
];
if (!isset($subnav[$section])) $section = 'overview';
$items = $subnav[$section];
// Default sub page
if ($sub === null && !empty($items)) $sub = $items[0]['key'];
$validSub = array_column($items, 'key');
if (!in_array($sub, $validSub, true) && !empty($items)) $sub = $items[0]['key'];
// Page title
$pageTitle = "Space UI $section / $sub";
// Admin demo (set to true to see footer admin link)
$isAdmin = false;
$partialsPath = __DIR__ . '/../src/partials';
?>
<!doctype html>
<html lang="de"
data-perf="auto"
data-alertpulse="burst">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($pageTitle) ?></title>
<!-- Apply per-browser settings early (no cookies; storage only) -->
<script>
(function(){
try{
const perf = localStorage.getItem('perf') || sessionStorage.getItem('perf');
const pulse = localStorage.getItem('alertpulse') || sessionStorage.getItem('alertpulse');
if (perf) document.documentElement.dataset.perf = perf;
if (pulse) document.documentElement.dataset.alertpulse = pulse;
}catch(e){}
})();
</script>
<!-- Orbitron -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/style.css">
</head>
<body>
<!-- Starfield Canvas (perf profile can disable it) -->
<canvas class="starfield" id="starfield" aria-hidden="true"></canvas>
<!-- Nebula/Planet Overlay -->
<div class="space-bg" aria-hidden="true"></div>
<div class="container">
<div class="app">
<!-- LINKS: Sidebar -->
<aside class="sidebar" aria-label="Seitenleiste">
<div class="card panel">
<?php include $partialsPath . '/menue.php'; ?>
</div>
<div class="card panel">
<?php include $partialsPath . '/menue2.php'; ?>
</div>
</aside>
<!-- RECHTS: Topbar -->
<header class="topbar card panel">
<div class="topbar-inner">
<div class="brand">
<span class="brand-dot"></span>
<div>
<div class="brand-title">ORBIT STATION</div>
<div class="muted">HUD Navigation • Planet: <?= htmlspecialchars(strtoupper($planet)) ?></div>
</div>
</div>
<div class="top-actions">
<button class="iconbtn" type="button" onclick="toggleNotif()" aria-label="Notifications">
🔔 <span class="badge" id="notifBadge">3</span>
</button>
<button class="btn btn-primary" type="button" onclick="toast('success','Beacon','Signal empfangen ✅')">Test Toast</button>
</div>
</div>
<!-- Notification dropdown -->
<div class="notif" id="notifPanel" hidden>
<div class="notif-head">
<div class="panel-title">NOTIFICATIONS</div>
<button class="iconbtn" type="button" onclick="toggleNotif()" aria-label="Close">✕</button>
</div>
<div class="notif-list">
<button class="notif-item" type="button" onclick="toast('info','Report','Spionagebericht empfangen',2200)">
<span class="notif-ico">📄</span>
<span>
<span class="notif-title">Spy Report</span>
<span class="notif-meta">vor 2 min</span>
</span>
</button>
<button class="notif-item" type="button" onclick="toast('success','Queue','Forschung abgeschlossen',2200)">
<span class="notif-ico">🧪</span>
<span>
<span class="notif-title">Research done</span>
<span class="notif-meta">vor 7 min</span>
</span>
</button>
<button class="notif-item" type="button" onclick="toast('error','Alarm','Flotte entdeckt!',2200)">
<span class="notif-ico">🚨</span>
<span>
<span class="notif-title">Hostile ping</span>
<span class="notif-meta">gerade eben</span>
</span>
</button>
</div>
</div>
</header>
<!-- OPTIONAL: Alert Banner (über Subnav) -->
<?php if (!empty($errorMessage)): ?>
<header class="alertbar card panel" role="alert" aria-live="polite">
<?php include $partialsPath . '/menue-top.php'; ?>
</header>
<?php endif; ?>
<!-- KONTEXTMENÜ (Subnav) mittig über Content -->
<nav class="subnav card panel" aria-label="Kontextmenü">
<div class="subnav-left">
<div class="panel-title"><?= htmlspecialchars(strtoupper($section)) ?></div>
<div class="muted">Kontextmenü</div>
</div>
<div class="subnav-tabs" role="tablist" aria-label="Sub Navigation Tabs">
<?php foreach ($items as $it): ?>
<?php
$active = ($it['key'] === $sub);
$href = "index.php?s=" . urlencode($section) . "&p=" . urlencode($it['key']) . "&planet=" . urlencode($planet);
?>
<a class="tab <?= $active ? 'is-active' : '' ?>" href="<?= htmlspecialchars($href) ?>" role="tab" aria-selected="<?= $active ? 'true' : 'false' ?>">
<?= htmlspecialchars($it['label']) ?>
</a>
<?php endforeach; ?>
</div>
</nav>
<!-- Ressourcen (sticky) -->
<div class="resourcebar card panel">
<?php include $partialsPath . '/ressourcen.php'; ?>
</div>
<!-- Content -->
<main class="content card panel cockpit" id="content">
<div class="cockpit-hud">
<div class="hud-left">SECTOR: ORION • DOCK-PORT: A3</div>
<div class="hud-right">
<span class="hud-pill">SHIELD 87%</span>
<span class="hud-pill">PING 14ms</span>
<span class="hud-pill">PERF <span id="perfLabel">AUTO</span></span>
</div>
</div>
<?php include $partialsPath . '/site.php'; ?>
</main>
<!-- Footer -->
<footer class="footer card panel">
<?php include $partialsPath . '/menue-foot.php'; ?>
<?php if ($isAdmin): ?>
<div class="divider"></div>
<a class="chip" href="index.php?s=admin&planet=<?= urlencode($planet) ?>">Admin</a>
<?php endif; ?>
</footer>
</div>
</div>
<!-- Toast Host -->
<div class="toast-host" id="toastHost" aria-live="polite" aria-atomic="true"></div>
<!-- JS -->
<script src="assets/ui.js"></script>
<script src="assets/starfield.js"></script>
<!-- PHP Flash Toasts -> JS -->
<script>
(function(){
const toasts = <?= json_encode($toasts, JSON_UNESCAPED_UNICODE) ?>;
if (Array.isArray(toasts)) toasts.forEach(t => toast(t.type, t.title, t.message));
document.getElementById('perfLabel').textContent = (document.documentElement.dataset.perf || 'auto').toUpperCase();
})();
</script>
</body>
</html>