setup
This commit is contained in:
@@ -1,3 +1,16 @@
|
||||
<?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>
|
||||
@@ -6,18 +19,62 @@
|
||||
<title>Nexus</title>
|
||||
<script>
|
||||
(() => {
|
||||
try {
|
||||
const theme = localStorage.getItem('nexus.theme') || 'day';
|
||||
const accent = localStorage.getItem('nexus.accent') || 'logo';
|
||||
document.documentElement.dataset.theme = theme;
|
||||
document.documentElement.dataset.accent = accent;
|
||||
} catch (error) {
|
||||
document.documentElement.dataset.theme = 'day';
|
||||
document.documentElement.dataset.accent = 'logo';
|
||||
}
|
||||
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>
|
||||
|
||||
Reference in New Issue
Block a user