Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
- Nüchterne, professionelle Optik: neutrale Flächen, Markenfarbe nur als Akzent, Inter-Schrift (lokal) - Zweizeiliger Header mit Suche, Hauptnavigation und Avatar-Menü - Startseite mit Begrüßungskarte, Schnellzugriffen und „Neu im Team“ - Personenverzeichnis mit Suche, Abteilungsfilter und Seitenaufteilung - Markenfarbe exakt übernommen, Abstufungen serverseitig in OKLCH (ColorPalette) – gemeinsam für Portal und Admin, keine Farbberechnung im Browser - Schnellzugriffe im Admin pflegbar - Filament-Avatare lokal statt über ui-avatars.com (DSGVO) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c0f8de791
commit
5a3f1f34c7
141 changed files with 3873 additions and 974 deletions
|
|
@ -12,7 +12,7 @@ class Branding
|
|||
{
|
||||
public const DEFAULT_NAME = 'Inhaus';
|
||||
|
||||
public const DEFAULT_PRIMARY_COLOR = '#2E6B5E';
|
||||
public const DEFAULT_PRIMARY_COLOR = '#0F4C5C';
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
|
|
@ -42,6 +42,33 @@ class Branding
|
|||
return $path ? Storage::disk('uploads')->url($path) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public function palette(): array
|
||||
{
|
||||
return ColorPalette::fromHex($this->primaryColor());
|
||||
}
|
||||
|
||||
/**
|
||||
* CSS-Variablen für das Portal. Werden serverseitig in die Seite geschrieben –
|
||||
* ohne Build und ohne Farbberechnung im Browser.
|
||||
*/
|
||||
public function cssVariables(): string
|
||||
{
|
||||
$color = $this->primaryColor();
|
||||
$variables = [
|
||||
'--brand' => $color,
|
||||
'--brand-foreground' => ColorPalette::foregroundFor($color),
|
||||
];
|
||||
|
||||
foreach ($this->palette() as $shade => $hex) {
|
||||
$variables["--brand-{$shade}"] = $hex;
|
||||
}
|
||||
|
||||
return collect($variables)->map(fn (string $value, string $name) => "{$name}:{$value}")->implode(';');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{portal_name: string, primary_color: string, logo_url: string|null}
|
||||
*/
|
||||
|
|
|
|||
166
app/Support/ColorPalette.php
Normal file
166
app/Support/ColorPalette.php
Normal file
|
|
@ -0,0 +1,166 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
/**
|
||||
* Leitet aus einer Markenfarbe eine Farbskala 50–950 ab (im OKLCH-Farbraum,
|
||||
* damit die Abstufungen gleichmäßig wirken). Die Markenfarbe selbst bleibt
|
||||
* unverändert und liegt auf Stufe 600 – dort, wo Portal und Admin-Backend
|
||||
* ihre Primär-Buttons einfärben.
|
||||
*/
|
||||
final class ColorPalette
|
||||
{
|
||||
/** Ziel-Helligkeiten einer „normalen“ Skala; wird an die Markenfarbe angepasst. */
|
||||
private const LIGHTNESS = [
|
||||
50 => 0.975, 100 => 0.945, 200 => 0.89, 300 => 0.81, 400 => 0.71,
|
||||
500 => 0.62, 600 => 0.54, 700 => 0.47, 800 => 0.40, 900 => 0.34, 950 => 0.26,
|
||||
];
|
||||
|
||||
/** Anteil der Sättigung je Stufe – helle und sehr dunkle Töne werden ruhiger. */
|
||||
private const CHROMA = [
|
||||
50 => 0.12, 100 => 0.22, 200 => 0.42, 300 => 0.65, 400 => 0.88,
|
||||
500 => 1.0, 600 => 1.0, 700 => 0.92, 800 => 0.82, 900 => 0.72, 950 => 0.6,
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<int, string> Stufe => Hex-Farbe
|
||||
*/
|
||||
public static function fromHex(string $hex): array
|
||||
{
|
||||
[$l, $c, $h] = self::hexToOklch($hex);
|
||||
|
||||
// Helligkeiten so verschieben, dass Stufe 600 genau der Markenfarbe entspricht,
|
||||
// die Skala aber monoton bleibt.
|
||||
$anchor = self::LIGHTNESS[600];
|
||||
$palette = [];
|
||||
|
||||
foreach (self::LIGHTNESS as $shade => $target) {
|
||||
if ($shade === 600) {
|
||||
$palette[$shade] = strtoupper($hex);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$lightness = $target > $anchor
|
||||
? $l + ($target - $anchor) / (1 - $anchor) * (0.985 - $l)
|
||||
: $l * ($target / $anchor);
|
||||
|
||||
$palette[$shade] = self::oklchToHex(
|
||||
max(0.12, min(0.985, $lightness)),
|
||||
$c * self::CHROMA[$shade],
|
||||
$h,
|
||||
);
|
||||
}
|
||||
|
||||
return $palette;
|
||||
}
|
||||
|
||||
/**
|
||||
* Schwarz oder Weiß – je nachdem, was auf der Farbe besser lesbar ist.
|
||||
*/
|
||||
public static function foregroundFor(string $hex): string
|
||||
{
|
||||
return self::contrast($hex, '#FFFFFF') >= self::contrast($hex, '#111111') ? '#FFFFFF' : '#111111';
|
||||
}
|
||||
|
||||
/**
|
||||
* Kontrastverhältnis nach WCAG 2.
|
||||
*/
|
||||
public static function contrast(string $a, string $b): float
|
||||
{
|
||||
$la = self::relativeLuminance($a);
|
||||
$lb = self::relativeLuminance($b);
|
||||
|
||||
return (max($la, $lb) + 0.05) / (min($la, $lb) + 0.05);
|
||||
}
|
||||
|
||||
private static function relativeLuminance(string $hex): float
|
||||
{
|
||||
[$r, $g, $b] = array_map(
|
||||
fn (float $v) => $v <= 0.04045 ? $v / 12.92 : (($v + 0.055) / 1.055) ** 2.4,
|
||||
self::hexToRgb($hex),
|
||||
);
|
||||
|
||||
return 0.2126 * $r + 0.7152 * $g + 0.0722 * $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float} sRGB 0..1
|
||||
*/
|
||||
private static function hexToRgb(string $hex): array
|
||||
{
|
||||
if (! preg_match('/^#?([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i', $hex, $m)) {
|
||||
throw new InvalidArgumentException("Ungültige Farbe: {$hex}");
|
||||
}
|
||||
|
||||
return [hexdec($m[1]) / 255, hexdec($m[2]) / 255, hexdec($m[3]) / 255];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float} L, C, h
|
||||
*/
|
||||
private static function hexToOklch(string $hex): array
|
||||
{
|
||||
[$r, $g, $b] = array_map(
|
||||
fn (float $v) => $v <= 0.04045 ? $v / 12.92 : (($v + 0.055) / 1.055) ** 2.4,
|
||||
self::hexToRgb($hex),
|
||||
);
|
||||
|
||||
$l = 0.4122214708 * $r + 0.5363325363 * $g + 0.0514459929 * $b;
|
||||
$m = 0.2119034982 * $r + 0.6806995451 * $g + 0.1073969566 * $b;
|
||||
$s = 0.0883024619 * $r + 0.2817188376 * $g + 0.6299787005 * $b;
|
||||
|
||||
[$l, $m, $s] = [$l ** (1 / 3), $m ** (1 / 3), $s ** (1 / 3)];
|
||||
|
||||
$L = 0.2104542553 * $l + 0.7936177850 * $m - 0.0040720468 * $s;
|
||||
$A = 1.9779984951 * $l - 2.4285922050 * $m + 0.4505937099 * $s;
|
||||
$B = 0.0259040371 * $l + 0.7827717662 * $m - 0.8086757660 * $s;
|
||||
|
||||
return [$L, sqrt($A * $A + $B * $B), atan2($B, $A)];
|
||||
}
|
||||
|
||||
private static function oklchToHex(float $L, float $C, float $h): string
|
||||
{
|
||||
// Sättigung reduzieren, bis die Farbe im sRGB-Farbraum darstellbar ist.
|
||||
for ($i = 0; $i < 40; $i++) {
|
||||
$rgb = self::oklchToLinearRgb($L, $C, $h);
|
||||
|
||||
if (min($rgb) >= -0.0005 && max($rgb) <= 1.0005) {
|
||||
break;
|
||||
}
|
||||
|
||||
$C *= 0.92;
|
||||
}
|
||||
|
||||
$hex = '#';
|
||||
|
||||
foreach ($rgb as $v) {
|
||||
$v = max(0.0, min(1.0, $v));
|
||||
$v = $v <= 0.0031308 ? 12.92 * $v : 1.055 * $v ** (1 / 2.4) - 0.055;
|
||||
$hex .= str_pad(strtoupper(dechex((int) round($v * 255))), 2, '0', STR_PAD_LEFT);
|
||||
}
|
||||
|
||||
return $hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{float, float, float}
|
||||
*/
|
||||
private static function oklchToLinearRgb(float $L, float $C, float $h): array
|
||||
{
|
||||
$A = $C * cos($h);
|
||||
$B = $C * sin($h);
|
||||
|
||||
$l = ($L + 0.3963377774 * $A + 0.2158037573 * $B) ** 3;
|
||||
$m = ($L - 0.1055613458 * $A - 0.0638541728 * $B) ** 3;
|
||||
$s = ($L - 0.0894841694 * $A - 1.2914855480 * $B) ** 3;
|
||||
|
||||
return [
|
||||
4.0767416621 * $l - 3.3077115913 * $m + 0.2309699292 * $s,
|
||||
-1.2684380046 * $l + 2.6097574011 * $m - 0.3413193965 * $s,
|
||||
-0.0041960863 * $l - 0.7034186168 * $m + 1.7076147010 * $s,
|
||||
];
|
||||
}
|
||||
}
|
||||
23
app/Support/Navigation.php
Normal file
23
app/Support/Navigation.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
* Hauptnavigation des Portals. Wird ab Phase 2 zu einer Registry, in die
|
||||
* Plugins eigene Einträge eintragen.
|
||||
*/
|
||||
class Navigation
|
||||
{
|
||||
/**
|
||||
* @return list<array{label: string, href: string, active: bool}>
|
||||
*/
|
||||
public function items(Request $request): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Startseite', 'href' => '/', 'active' => $request->routeIs('dashboard')],
|
||||
['label' => 'Personen', 'href' => '/personen', 'active' => $request->routeIs('people.*')],
|
||||
];
|
||||
}
|
||||
}
|
||||
72
app/Support/QuickLinks.php
Normal file
72
app/Support/QuickLinks.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace App\Support;
|
||||
|
||||
/**
|
||||
* Schnellzugriffe auf der Startseite (App-Launcher), gepflegt im Admin-Bereich.
|
||||
*/
|
||||
class QuickLinks
|
||||
{
|
||||
/**
|
||||
* Auswahl an Symbolen (Lucide-Namen). Das Portal bündelt genau diese Symbole,
|
||||
* deshalb ist die Liste bewusst begrenzt.
|
||||
*/
|
||||
public const ICONS = [
|
||||
'link' => 'Link',
|
||||
'clock' => 'Uhr / Zeiterfassung',
|
||||
'calendar-days' => 'Kalender / Dienstplan',
|
||||
'plane' => 'Urlaub',
|
||||
'receipt' => 'Reisekosten / Belege',
|
||||
'graduation-cap' => 'Fortbildung',
|
||||
'headset' => 'IT-Support',
|
||||
'utensils' => 'Speiseplan',
|
||||
'car' => 'Fahrdienst',
|
||||
'file-text' => 'Formulare / Dokumente',
|
||||
'book-open' => 'Handbuch / Richtlinien',
|
||||
'users' => 'Personen / Teams',
|
||||
'mail' => 'E-Mail',
|
||||
'message-square' => 'Chat / Feedback',
|
||||
'lightbulb' => 'Ideen',
|
||||
'shield-check' => 'Datenschutz / Sicherheit',
|
||||
'heart-handshake' => 'Soziales / MAV',
|
||||
'building-2' => 'Standorte',
|
||||
'wrench' => 'Technik / Hausmeister',
|
||||
'monitor' => 'Anwendung',
|
||||
'folder' => 'Ablage',
|
||||
'phone' => 'Telefonbuch',
|
||||
'megaphone' => 'Ankündigungen',
|
||||
'briefcase' => 'Stellenangebote',
|
||||
];
|
||||
|
||||
public function __construct(private readonly Settings $settings) {}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, url: string, icon: string, new_tab: bool}>
|
||||
*/
|
||||
public function all(): array
|
||||
{
|
||||
$links = $this->settings->get('portal.quick_links');
|
||||
|
||||
if (! is_array($links)) {
|
||||
return $this->defaults();
|
||||
}
|
||||
|
||||
return array_values(array_map(fn (array $link) => [
|
||||
'label' => (string) ($link['label'] ?? ''),
|
||||
'url' => preg_match('#^(https?://|/)#i', (string) ($link['url'] ?? '')) ? (string) $link['url'] : '#',
|
||||
'icon' => array_key_exists($link['icon'] ?? '', self::ICONS) ? $link['icon'] : 'link',
|
||||
'new_tab' => (bool) ($link['new_tab'] ?? false),
|
||||
], $links));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<array{label: string, url: string, icon: string, new_tab: bool}>
|
||||
*/
|
||||
public function defaults(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Personen', 'url' => '/personen', 'icon' => 'users', 'new_tab' => false],
|
||||
['label' => 'Mein Profil', 'url' => '/profil/bearbeiten', 'icon' => 'file-text', 'new_tab' => false],
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue