81 lines
3.7 KiB
PHP
Executable File
81 lines
3.7 KiB
PHP
Executable File
<?php
|
|
$requestPath = app()->request()->path();
|
|
$currentModuleName = current_module_name();
|
|
if ($currentModuleName === null && preg_match('~^/modules/(?:setup|access)/([a-zA-Z0-9_-]+)~', $requestPath, $moduleMatch)) {
|
|
$currentModuleName = $moduleMatch[1];
|
|
}
|
|
$currentModule = $currentModuleName !== null ? modules()->get($currentModuleName) : null;
|
|
$headerEyebrow = $currentModule ? 'Modul' : 'Nexus';
|
|
$headerTitle = $currentModule ? (string)($currentModule['title'] ?? $currentModuleName) : (defined('APP_DOMAIN_PRIMARY') ? (string)APP_DOMAIN_PRIMARY : 'Nexus');
|
|
$headerText = $currentModule ? (string)($currentModule['description'] ?? '') : 'Kompakter Einstieg fuer die verfuegbaren Module.';
|
|
$auth = app()->auth();
|
|
$authUser = $auth->user();
|
|
?>
|
|
<!doctype html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Nexus</title>
|
|
<script>
|
|
(() => {
|
|
const moduleName = <?= json_encode($currentModuleName) ?>;
|
|
const read = (key, fallback) => {
|
|
try { return localStorage.getItem(key) || fallback; } catch (error) { return fallback; }
|
|
};
|
|
const mainTheme = read('nexus.theme', 'day');
|
|
const mainAccent = read('nexus.accent', 'logo');
|
|
const moduleTheme = moduleName ? read(`nexus.module.${moduleName}.theme`, 'inherit') : mainTheme;
|
|
const moduleAccent = moduleName ? read(`nexus.module.${moduleName}.accent`, 'inherit') : mainAccent;
|
|
document.documentElement.dataset.module = moduleName || '';
|
|
document.documentElement.dataset.theme = moduleTheme === 'inherit' ? mainTheme : moduleTheme;
|
|
document.documentElement.dataset.accent = moduleAccent === 'inherit' ? mainAccent : moduleAccent;
|
|
})();
|
|
</script>
|
|
<link rel="stylesheet" href="<?= e(app()->assets()->versioned('/assets/css/app.css')) ?>">
|
|
</head>
|
|
<body>
|
|
<main class="main-shell">
|
|
<section class="home-hero app-header" data-module-name="<?= e((string)($currentModuleName ?? '')) ?>">
|
|
<a class="brand-mark" href="/" aria-label="Nexus">
|
|
<img src="/assets/images/logo.png" alt="Nexus Logo">
|
|
</a>
|
|
<div class="brand-copy">
|
|
<span class="eyebrow"><?= e($headerEyebrow) ?></span>
|
|
<h1><?= e($headerTitle) ?></h1>
|
|
<?php if ($headerText !== ''): ?>
|
|
<p><?= e($headerText) ?></p>
|
|
<?php endif; ?>
|
|
</div>
|
|
<div class="theme-switcher" aria-label="Darstellung">
|
|
<?php if ($auth->isEnabled()): ?>
|
|
<a class="auth-pill" href="<?= $authUser === null ? '/auth/login' : '/auth/logout' ?>">
|
|
<?= $authUser === null ? 'Login' : 'Logout ' . e((string)($authUser['username'] ?? $authUser['name'] ?? '')) ?>
|
|
</a>
|
|
<?php endif; ?>
|
|
<label>
|
|
<span>Modus</span>
|
|
<select data-theme-mode data-theme-scope="<?= $currentModuleName !== null ? 'module' : 'main' ?>">
|
|
<?php if ($currentModuleName !== null): ?>
|
|
<option value="inherit">Wie Hauptsystem</option>
|
|
<?php endif; ?>
|
|
<option value="day">Day</option>
|
|
<option value="night">Night</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
<span>Farbe</span>
|
|
<select data-theme-accent data-theme-scope="<?= $currentModuleName !== null ? 'module' : 'main' ?>">
|
|
<?php if ($currentModuleName !== null): ?>
|
|
<option value="inherit">Wie Hauptsystem</option>
|
|
<?php endif; ?>
|
|
<option value="logo">Logo</option>
|
|
<option value="pink">Pink</option>
|
|
<option value="cyan">Cyan</option>
|
|
<option value="orange">Orange</option>
|
|
<option value="green">Gruen</option>
|
|
</select>
|
|
</label>
|
|
</div>
|
|
</section>
|