Loheide-eu-mitarbeiterplatt.../app/Support/Branding.php
Friederich Loheide 5a3f1f34c7
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
Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
- 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>
2026-09-25 20:51:53 +00:00

83 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Support;
use Illuminate\Support\Facades\Storage;
/**
* Basis-Branding der Installation (Phase 0): Portalname, Logo, Primärfarbe.
* Das vollständige Erscheinungsbild folgt in Phase 5 (docs/PLAN.md, Abschnitt 12).
*/
class Branding
{
public const DEFAULT_NAME = 'Inhaus';
public const DEFAULT_PRIMARY_COLOR = '#0F4C5C';
public function __construct(private readonly Settings $settings) {}
public function portalName(): string
{
return $this->settings->get('branding.portal_name') ?: self::DEFAULT_NAME;
}
public function primaryColor(): string
{
$color = $this->settings->get('branding.primary_color');
return is_string($color) && preg_match('/^#[0-9a-fA-F]{6}$/', $color)
? strtoupper($color)
: self::DEFAULT_PRIMARY_COLOR;
}
public function logoPath(): ?string
{
return $this->settings->get('branding.logo_path') ?: null;
}
public function logoUrl(): ?string
{
$path = $this->logoPath();
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}
*/
public function toArray(): array
{
return [
'portal_name' => $this->portalName(),
'primary_color' => $this->primaryColor(),
'logo_url' => $this->logoUrl(),
];
}
}