Loheide-eu-mitarbeiterplatt.../resources/js/pages/Dashboard.vue
Friederich Loheide 38f47f98e2
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 14m38s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 14m13s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 11m56s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 11m44s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 56m9s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 1h2m6s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 10m30s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m13s
Oberfläche Mitarbeiter-App umschaltbar (0.52.0)
Einstellung interface (classic|app) im Erscheinungsbild; data-ui am Wurzelelement,
warme Tokens, Karten mit Schatten, Menüpunkte als Pillen; Startseite dreispaltig.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 19:17:23 +00:00

101 lines
5.5 KiB
Vue
Raw Permalink 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.

<script setup>
import { computed } from 'vue';
import { usePage } from '@inertiajs/vue3';
import { useMediaQuery } from '@vueuse/core';
import { Eye } from '@lucide/vue';
import AppLayout from '@/layouts/AppLayout.vue';
import PageContent from '@/pagebuilder/PageContent.vue';
import { widgetComponent } from '@/lib/widgets';
/**
* Startseite aus Kacheln (App\Dashboard\Widgets). Kern und Plugins liefern die
* Kacheln; diese Seite ordnet sie nur nach Bereichen an.
*/
const props = defineProps({
widgets: { type: Array, default: () => [] },
// Frei gestaltete Startseite (App\Dashboard\Homepage): Blöcke statt Kacheln
content: { type: Object, default: null },
preview: { type: Boolean, default: false },
});
const desktop = useMediaQuery('(min-width: 1024px)');
const known = computed(() => props.widgets.filter((widget) => widgetComponent(widget.component)));
const inArea = (area) => known.value.filter((widget) => widget.area === area);
const hero = computed(() => inArea('hero')[0] ?? null);
const mobile = computed(() => [...known.value].sort((a, b) => a.mobileSort - b.mobileSort));
// Oberfläche „Mitarbeiter-App“: drei Spalten – links ich (Begrüßung, Anwendungen, Gruppen),
// in der Mitte das Geschehen (Neuigkeiten), rechts der Tag (Aufgaben, Termine, Feiern …)
const page = usePage();
const isApp = computed(() => page.props.branding?.interface === 'app');
const LEFT = ['core.greeting', 'core.quick-links', 'gruppen.feed', 'downloads.favorites', 'core.people-search'];
const appLeft = computed(() => LEFT.map((key) => known.value.find((widget) => widget.key === key)).filter(Boolean));
const appCenter = computed(() => known.value.filter((widget) => !LEFT.includes(widget.key) && ['top', 'hero', 'feed', 'main'].includes(widget.area)));
const appRight = computed(() => known.value.filter((widget) => !LEFT.includes(widget.key) && widget.area === 'aside'));
</script>
<template>
<AppLayout title="Startseite" :header="false">
<template v-if="content">
<div v-if="preview" class="mb-6 flex flex-wrap items-center gap-x-4 gap-y-2 rounded-lg border border-amber-300 bg-amber-50 px-4 py-2.5 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950/50 dark:text-amber-100">
<Eye class="size-4 shrink-0" />
<span class="flex-1">Vorschau des Entwurfs – so sieht die Startseite nach dem Veröffentlichen aus (mit Ihren Rechten).</span>
<a href="/startseite/gestalten" class="font-medium underline">Zurück zum Editor</a>
</div>
<PageContent :content="content" />
</template>
<!-- Mitarbeiter-App: drei Spalten -->
<div v-else-if="isApp && desktop" class="grid grid-cols-[17.5rem_minmax(0,1fr)] items-start gap-6 xl:grid-cols-[17.5rem_minmax(0,1fr)_21rem]">
<aside class="grid min-w-0 content-start gap-5">
<component :is="widgetComponent(widget.component)" v-for="widget in appLeft" :key="widget.key" v-bind="widget.props" variant="list" />
</aside>
<div class="grid min-w-0 content-start gap-5">
<component
:is="widgetComponent(widget.component)"
v-for="widget in appCenter"
:key="widget.key"
v-bind="widget.props"
:wide="widget.area === 'feed' ? true : undefined"
/>
<!-- Unter 1280 px rutscht die rechte Spalte unter die Mitte -->
<div class="grid content-start gap-5 xl:hidden">
<component :is="widgetComponent(widget.component)" v-for="widget in appRight" :key="widget.key" v-bind="widget.props" />
</div>
</div>
<aside class="hidden min-w-0 content-start gap-5 xl:grid">
<component :is="widgetComponent(widget.component)" v-for="widget in appRight" :key="widget.key" v-bind="widget.props" />
</aside>
</div>
<template v-else>
<div v-if="desktop && inArea('top').length" class="mb-6 grid gap-6">
<component :is="widgetComponent(widget.component)" v-for="widget in inArea('top')" :key="widget.key" v-bind="widget.props" />
</div>
<div v-if="desktop" class="grid grid-cols-12 gap-6">
<div class="col-span-8 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-9 xl:grid-cols-3">
<component :is="widgetComponent(hero.component)" v-if="hero" v-bind="hero.props" class="xl:col-span-2" />
<component
:is="widgetComponent(widget.component)"
v-for="widget in inArea('feed')"
:key="widget.key"
v-bind="widget.props"
:wide="!hero"
:class="hero ? 'xl:col-span-1' : 'xl:col-span-3'"
/>
<component :is="widgetComponent(widget.component)" v-for="widget in inArea('main')" :key="widget.key" v-bind="widget.props" class="xl:col-span-3" />
</div>
<aside class="col-span-4 grid min-w-0 grid-cols-1 content-start gap-6 xl:col-span-3">
<component :is="widgetComponent(widget.component)" v-for="widget in inArea('aside')" :key="widget.key" v-bind="widget.props" />
</aside>
</div>
<div v-else class="grid min-w-0 grid-cols-1 gap-6">
<component :is="widgetComponent(widget.component)" v-for="widget in mobile" :key="widget.key" v-bind="widget.props" />
</div>
</template>
</AppLayout>
</template>