Neue Seitenköpfe, global wählbar (0.48.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m29s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m31s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 9m3s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 9m36s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m33s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 13m56s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 12m35s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 11m58s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 50s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m13s

- PageHeader: Kopfband (Standard, kompakt), Kopfband mit Symbol, mit Symbol,
  kräftiger Titel – Einstellung page_header im Erscheinungsbild
- Symbol vom passenden Menüpunkt (aktiv oder per Adresse), Prop icon
- In Spalten (z. B. Downloads) schlichte Form statt Band
- Zurück-Links als breadcrumbs (IT-Service), Profil bearbeiten mit PageHeader
- Plugin-Assets: Fingerabdruck berücksichtigt Änderungszeiten der Dateien

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-28 20:05:37 +00:00
parent 36a58d4748
commit 800e267e1c
144 changed files with 524 additions and 390 deletions

View file

@ -1,36 +1,132 @@
<script setup>
import { Link } from '@inertiajs/vue3';
import { computed, onMounted, ref } from 'vue';
import { Link, usePage } from '@inertiajs/vue3';
import { ChevronRight } from '@lucide/vue';
import AppIcon from '@/components/AppIcon.vue';
/**
* Einheitlicher Seitenkopf: Pfad, Titel, Unterzeile und Aktionen rechts.
* Die Gestaltung ist im Backend wählbar (Erscheinungsbild → Farben → Seitenköpfe):
* band (Standard), band_icon, icon, bold.
*/
defineProps({
const props = defineProps({
title: { type: String, required: true },
description: { type: String, default: '' },
breadcrumbs: { type: Array, default: () => [] }, // [{ label, href }]
/** Symbol des Bereichs (Lucide-Name); leer = Symbol des passenden Menüpunkts */
icon: { type: String, default: null },
});
const page = usePage();
const variant = computed(() => page.props.branding?.page_header ?? 'band');
// Das Band läuft über die volle Breite – nur, wenn der Kopf auch die volle Inhaltsbreite hat
// (nicht z. B. in einer Spalte neben einer Seitenleiste). Sonst schlichte Form mit Trennlinie.
const el = ref(null);
const fullWidth = ref(true);
onMounted(() => {
const parent = el.value?.parentElement;
const main = el.value?.closest('main');
if (!parent || !main) return;
const inner = main.clientWidth - parseFloat(getComputedStyle(main).paddingLeft) - parseFloat(getComputedStyle(main).paddingRight);
fullWidth.value = parent.getBoundingClientRect().width >= inner - 2;
});
const isBand = computed(() => (variant.value === 'band' || variant.value === 'band_icon') && fullWidth.value);
const inset = computed(() => (variant.value === 'band' || variant.value === 'band_icon') && !fullWidth.value);
const withIcon = computed(() => variant.value === 'band_icon' || variant.value === 'icon');
// Passender Menüpunkt – aktiv markiert oder, sonst, der längste, mit dem die Adresse beginnt
const menuItem = computed(() => {
const items = page.props.navigation ?? [];
for (const item of items) {
const child = (item.children ?? []).find((c) => c.active);
if (child) return { icon: child.icon ?? item.icon, area: item.label, label: child.label };
if (item.active) return { icon: item.icon, area: null, label: item.label };
}
const path = (page.url ?? '').split(/[?#]/)[0];
let best = null;
for (const item of items) {
for (const entry of [item, ...(item.children ?? [])]) {
const href = entry.href ?? '';
if (href.length > 1 && href.startsWith('/') && (path === href || path.startsWith(`${href}/`)) && (!best || href.length > best.href.length)) {
best = { href, icon: entry.icon ?? item.icon, area: entry === item ? null : item.label, label: entry.label };
}
}
}
return best;
});
const pageIcon = computed(() => props.icon ?? menuItem.value?.icon ?? null);
// Kleine Bereichszeile über dem Titel (nur „Kräftiger Titel“, wenn es keinen Pfad gibt)
const eyebrow = computed(() => menuItem.value?.area ?? (menuItem.value && menuItem.value.label !== props.title ? menuItem.value.label : null));
const showEyebrow = computed(() => variant.value === 'bold' && !props.breadcrumbs.length && !!eyebrow.value);
</script>
<template>
<header class="mb-6 flex flex-wrap items-end justify-between gap-x-6 gap-y-4">
<div class="flex min-w-0 items-end gap-3.5">
<slot name="leading" />
<div class="min-w-0">
<nav v-if="breadcrumbs.length" class="mb-1 flex flex-wrap items-center gap-1 text-[13px] text-muted-foreground" aria-label="Brotkrumen">
<template v-for="(crumb, index) in breadcrumbs" :key="crumb.href">
<ChevronRight v-if="index" class="size-3.5" />
<Link :href="crumb.href" class="hover:text-foreground hover:underline">{{ crumb.label }}</Link>
</template>
</nav>
<h1 class="text-2xl leading-tight font-semibold tracking-tight">{{ title }}</h1>
<p v-if="description || $slots.description" class="mt-1 max-w-3xl text-sm text-muted-foreground">
<slot name="description">{{ description }}</slot>
</p>
<header
ref="el"
:class="{
'mb-6 border-b pb-4': inset,
'relative mb-6 border-b bg-card first:-mt-6 lg:first:-mt-7': isBand,
'mb-6 border-b pb-5': variant === 'icon',
'mb-7': variant === 'bold',
}"
:style="isBand ? { width: '100vw', marginLeft: 'calc(50% - 50vw)' } : null"
>
<div
class="flex flex-wrap justify-between gap-y-3"
:class="[
isBand ? 'mx-auto max-w-[1440px] items-center gap-x-8 px-4 py-4 lg:px-6' : 'gap-x-6',
variant === 'icon' ? 'items-center' : '',
variant === 'bold' ? 'items-end' : '',
]"
>
<div class="flex min-w-0 items-center" :class="withIcon ? 'gap-3.5' : 'gap-3'">
<slot name="leading">
<span
v-if="withIcon && pageIcon"
class="grid shrink-0 place-items-center rounded-lg bg-brand-soft text-brand-text"
:class="variant === 'icon' ? 'size-12' : 'size-10'"
aria-hidden="true"
>
<AppIcon :name="pageIcon" :class="variant === 'icon' ? 'size-6' : 'size-5'" :stroke-width="1.75" />
</span>
</slot>
<div class="min-w-0">
<nav v-if="breadcrumbs.length" class="mb-0.5 flex flex-wrap items-center gap-1 text-[13px] text-muted-foreground" aria-label="Brotkrumen">
<template v-for="(crumb, index) in breadcrumbs" :key="crumb.href">
<ChevronRight v-if="index" class="size-3.5" />
<Link :href="crumb.href" class="hover:text-foreground hover:underline">{{ crumb.label }}</Link>
</template>
</nav>
<p v-else-if="showEyebrow" class="mb-1 text-xs font-semibold tracking-[0.08em] text-brand-text uppercase">{{ eyebrow }}</p>
<h1
class="leading-tight tracking-tight"
:class="{
'text-2xl font-semibold': isBand || inset,
'text-[26px] font-semibold': variant === 'icon',
'text-3xl font-bold': variant === 'bold',
}"
>
{{ title }}
</h1>
<span v-if="variant === 'bold'" class="mt-2.5 block h-[3px] w-10 rounded-full bg-brand" aria-hidden="true" />
<p
v-if="description || $slots.description"
class="max-w-3xl text-muted-foreground"
:class="variant === 'bold' ? 'mt-2.5 text-[15px]' : 'mt-0.5 text-sm'"
>
<slot name="description">{{ description }}</slot>
</p>
</div>
</div>
<div v-if="$slots.actions" class="flex w-full flex-wrap items-center gap-2 sm:w-auto">
<slot name="actions" />
</div>
</div>
<div v-if="$slots.actions" class="flex w-full flex-wrap items-center gap-2 sm:w-auto">
<slot name="actions" />
</div>
</header>
</template>