Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m21s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m55s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 7m25s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 7m57s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m16s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m34s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m14s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
68 lines
3.3 KiB
Vue
68 lines
3.3 KiB
Vue
<script setup>
|
||
import { computed } from 'vue';
|
||
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));
|
||
</script>
|
||
|
||
<template>
|
||
<AppLayout title="Startseite">
|
||
<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>
|
||
|
||
<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>
|