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>
133 lines
8.1 KiB
Vue
133 lines
8.1 KiB
Vue
<script setup>
|
||
import { pluginComponent } from '@/lib/pluginComponents';
|
||
import { computed, defineAsyncComponent, watch } from 'vue';
|
||
import { Link, usePage } from '@inertiajs/vue3';
|
||
import { ChevronRight, LayoutDashboard, PartyPopper, Plus } from '@lucide/vue';
|
||
import { toast } from 'vue-sonner';
|
||
import AppIcon from '@/components/AppIcon.vue';
|
||
import EmptyState from '@/components/EmptyState.vue';
|
||
import PageHeader from '@/components/PageHeader.vue';
|
||
import AppLayout from '@/layouts/AppLayout.vue';
|
||
|
||
/**
|
||
* Redaktion: links die Bereiche (mit offenen Aufgaben), rechts die Übersicht oder ein Bereich.
|
||
* Bereiche kommen aus Plugins („<plugin>::Name“ aus plugins-core/<plugin>/resources/js/editorial).
|
||
*/
|
||
const props = defineProps({
|
||
areas: { type: Array, required: true },
|
||
active: { type: String, default: null },
|
||
section: { type: Object, default: null },
|
||
});
|
||
|
||
const page = usePage();
|
||
watch(() => page.props.flash?.status, (status) => status && toast.success(status), { immediate: true });
|
||
|
||
const loaders = import.meta.glob('../../../../plugins-core/*/resources/js/editorial/*.vue');
|
||
const components = {};
|
||
|
||
for (const [path, loader] of Object.entries(loaders)) {
|
||
const [, slug] = path.match(/plugins-core\/([^/]+)\//);
|
||
components[`${slug}::${path.split('/').pop().replace('.vue', '')}`] = defineAsyncComponent(loader);
|
||
}
|
||
|
||
// Abschnitte des Kerns („core::Name“ aus resources/js/components/editorial), z. B. die Mediathek.
|
||
for (const [path, loader] of Object.entries(import.meta.glob('../../components/editorial/*.vue'))) {
|
||
components[`core::${path.split('/').pop().replace('.vue', '')}`] = defineAsyncComponent(loader);
|
||
}
|
||
|
||
const href = (key) => (key ? `/redaktion?bereich=${encodeURIComponent(key)}` : '/redaktion');
|
||
const todos = computed(() => props.areas.filter((a) => a.todo));
|
||
const creates = computed(() => props.areas.filter((a) => a.create));
|
||
const totalTodo = computed(() => todos.value.reduce((sum, a) => sum + a.todo.count, 0));
|
||
const current = computed(() => props.areas.find((a) => a.key === props.active));
|
||
</script>
|
||
|
||
<template>
|
||
<AppLayout :title="current ? `${current.label} – Redaktion` : 'Redaktion'">
|
||
<PageHeader icon="pen-line"
|
||
:title="current?.label ?? 'Redaktion'"
|
||
:breadcrumbs="current ? [{ label: 'Redaktion', href: '/redaktion' }] : []"
|
||
:description="current ? '' : 'Ihre Seiten, Beiträge und Freigaben – auf einen Blick, was gerade ansteht.'"
|
||
/>
|
||
|
||
<div class="grid gap-6 lg:grid-cols-[15rem_minmax(0,1fr)]">
|
||
<!-- Bereiche: am PC als Leiste links, auf dem Handy wischbar oben -->
|
||
<nav aria-label="Bereiche der Redaktion" class="-mx-4 overflow-x-auto px-4 lg:mx-0 lg:overflow-visible lg:px-0">
|
||
<ul class="flex gap-1.5 lg:sticky lg:top-24 lg:grid lg:gap-0.5">
|
||
<li class="shrink-0">
|
||
<Link
|
||
:href="href(null)"
|
||
class="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm whitespace-nowrap"
|
||
:class="!active ? 'bg-brand-soft font-semibold text-brand-soft-foreground' : 'text-foreground/80 hover:bg-accent max-lg:border max-lg:bg-card'"
|
||
:aria-current="!active ? 'page' : undefined"
|
||
>
|
||
<LayoutDashboard class="size-4 shrink-0" />
|
||
<span class="flex-1">Übersicht</span>
|
||
<span v-if="totalTodo" class="rounded-full bg-brand px-1.5 text-[11px] font-semibold text-brand-foreground tabular-nums">{{ totalTodo }}</span>
|
||
</Link>
|
||
</li>
|
||
<li v-for="area in areas" :key="area.key" class="shrink-0">
|
||
<Link
|
||
:href="href(area.key)"
|
||
class="flex items-center gap-2.5 rounded-md px-3 py-2 text-sm whitespace-nowrap"
|
||
:class="active === area.key ? 'bg-brand-soft font-semibold text-brand-soft-foreground' : 'text-foreground/80 hover:bg-accent max-lg:border max-lg:bg-card'"
|
||
:aria-current="active === area.key ? 'page' : undefined"
|
||
>
|
||
<AppIcon :name="area.icon" class="size-4 shrink-0 opacity-80" />
|
||
<span class="flex-1">{{ area.label }}</span>
|
||
<span v-if="area.todo" class="rounded-full bg-brand px-1.5 text-[11px] font-semibold text-brand-foreground tabular-nums" :aria-label="`${area.todo.count} ${area.todo.label}`">{{ area.todo.count }}</span>
|
||
</Link>
|
||
</li>
|
||
</ul>
|
||
</nav>
|
||
|
||
<div class="min-w-0">
|
||
<!-- Ein Bereich -->
|
||
<component
|
||
:is="components[section.component] ?? pluginComponent(section.component, 'editorial')"
|
||
v-if="section"
|
||
:key="section.key"
|
||
v-bind="section.props"
|
||
/>
|
||
|
||
<!-- Übersicht -->
|
||
<div v-else class="grid gap-6">
|
||
<section aria-labelledby="todo-heading">
|
||
<h2 id="todo-heading" class="mb-3 text-sm font-semibold">Steht an</h2>
|
||
<div v-if="todos.length" class="grid gap-3 sm:grid-cols-2 xl:grid-cols-3">
|
||
<Link v-for="area in todos" :key="area.key" :href="href(area.key)" class="group flex items-center gap-4 rounded-xl border bg-card p-4 shadow-xs transition-shadow hover:shadow-md">
|
||
<span class="grid size-11 shrink-0 place-items-center rounded-lg bg-brand-soft text-brand-text"><AppIcon :name="area.icon" class="size-5" /></span>
|
||
<span class="min-w-0 flex-1">
|
||
<span class="block text-2xl leading-none font-semibold tabular-nums">{{ area.todo.count }}</span>
|
||
<span class="block text-sm text-muted-foreground">{{ area.todo.label }}</span>
|
||
</span>
|
||
<ChevronRight class="size-4 text-muted-foreground transition-transform group-hover:translate-x-0.5" />
|
||
</Link>
|
||
</div>
|
||
<div v-else class="rounded-xl border bg-card"><EmptyState :icon="PartyPopper" title="Alles erledigt" text="Gerade wartet nichts auf Sie. Links finden Sie alle Bereiche." /></div>
|
||
</section>
|
||
|
||
<section v-if="creates.length" aria-labelledby="create-heading">
|
||
<h2 id="create-heading" class="mb-3 text-sm font-semibold">Neu anlegen</h2>
|
||
<div class="flex flex-wrap gap-2">
|
||
<Link v-for="area in creates" :key="area.key" :href="area.create.href" class="inline-flex items-center gap-2 rounded-md border bg-card px-3 py-2 text-sm font-medium shadow-xs hover:bg-accent">
|
||
<Plus class="size-4 text-brand-text" /> {{ area.create.label }}
|
||
</Link>
|
||
</div>
|
||
</section>
|
||
|
||
<section aria-labelledby="areas-heading">
|
||
<h2 id="areas-heading" class="mb-3 text-sm font-semibold">Alle Bereiche</h2>
|
||
<div class="grid grid-cols-2 gap-3 sm:grid-cols-3 xl:grid-cols-4">
|
||
<Link v-for="area in areas" :key="area.key" :href="href(area.key)" class="flex items-center gap-3 rounded-lg border bg-card p-3 text-sm font-medium shadow-xs hover:bg-accent/60">
|
||
<AppIcon :name="area.icon" class="size-5 shrink-0 text-brand-text" />
|
||
<span class="min-w-0 flex-1 truncate">{{ area.label }}</span>
|
||
<span v-if="area.todo" class="rounded-full bg-brand px-1.5 text-[11px] font-semibold text-brand-foreground tabular-nums">{{ area.todo.count }}</span>
|
||
</Link>
|
||
</div>
|
||
</section>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</AppLayout>
|
||
</template>
|