Startseite frei gestalten, Neuigkeiten-Block mit Kategorien-Filter (0.26.0)
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
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>
This commit is contained in:
parent
6290e09074
commit
2c96fcce1c
151 changed files with 1515 additions and 317 deletions
22
resources/js/pagebuilder/blocks/WidgetBlock.vue
Normal file
22
resources/js/pagebuilder/blocks/WidgetBlock.vue
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
<script setup>
|
||||
import { computed, inject } from 'vue';
|
||||
import { LayoutDashboard } from '@lucide/vue';
|
||||
import { widgetComponent } from '@/lib/widgets';
|
||||
|
||||
/**
|
||||
* Block „Kachel“ der frei gestalteten Startseite: zeigt eine Startseiten-Kachel
|
||||
* mit den Daten der angemeldeten Person.
|
||||
*/
|
||||
const props = defineProps({ block: { type: Object, required: true } });
|
||||
|
||||
const editing = inject('pagebuilder:editing', computed(() => false));
|
||||
const component = computed(() => (props.block.props?.component ? widgetComponent(props.block.props.component) : null));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component :is="component" v-if="component" v-bind="block.props.props" class="min-w-0" :class="{ 'pointer-events-none select-none': editing }" />
|
||||
<div v-else-if="editing" class="flex items-center gap-2 rounded-md border border-dashed p-4 text-sm text-muted-foreground">
|
||||
<LayoutDashboard class="size-4 shrink-0" />
|
||||
{{ block.data.widget ? 'Diese Kachel ist für Sie gerade leer oder ausgeblendet – andere sehen sie womöglich.' : 'Bitte rechts eine Kachel auswählen.' }}
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -233,6 +233,19 @@ watch(iconQuery, (query) => query.trim() && loadIconSet());
|
|||
<Input v-else-if="field.type === 'number'" :id="id" v-model.number="model" type="number" :min="field.min" :max="field.max" />
|
||||
<NativeSelect v-else-if="field.type === 'select'" :id="id" v-model="model" :options="field.choices" />
|
||||
|
||||
<div v-else-if="field.type === 'multiselect'" :id="id" class="grid max-h-44 gap-0.5 overflow-y-auto rounded-md border p-1">
|
||||
<label v-for="choice in field.choices" :key="choice.value" class="flex items-center gap-2 rounded px-1.5 py-0.5 text-[13px] hover:bg-accent">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="size-4 accent-[var(--brand)]"
|
||||
:checked="(model ?? []).includes(choice.value)"
|
||||
@change="model = (model ?? []).includes(choice.value) ? model.filter((v) => v !== choice.value) : [...(model ?? []), choice.value]"
|
||||
/>
|
||||
{{ choice.label }}
|
||||
</label>
|
||||
<p v-if="!field.choices?.length" class="px-1.5 py-1 text-[13px] text-muted-foreground">Keine Einträge vorhanden.</p>
|
||||
</div>
|
||||
|
||||
<label v-else-if="field.type === 'toggle'" :for="id" class="flex items-center justify-between gap-3 py-0.5 text-[13px] font-medium">
|
||||
{{ field.label }}
|
||||
<Switch :id="id" v-model="model" />
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ import {
|
|||
ClipboardList,
|
||||
Cake,
|
||||
Component,
|
||||
LayoutDashboard,
|
||||
} from '@lucide/vue';
|
||||
|
||||
/**
|
||||
|
|
@ -57,6 +58,7 @@ const icons = {
|
|||
'clipboard-list': ClipboardList,
|
||||
cake: Cake,
|
||||
component: Component,
|
||||
'layout-dashboard': LayoutDashboard,
|
||||
};
|
||||
|
||||
export function blockIcon(name) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
<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';
|
||||
|
||||
/**
|
||||
|
|
@ -9,7 +11,10 @@ import { widgetComponent } from '@/lib/widgets';
|
|||
* Kacheln; diese Seite ordnet sie nur nach Bereichen an.
|
||||
*/
|
||||
const props = defineProps({
|
||||
widgets: { type: Array, required: true },
|
||||
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)');
|
||||
|
|
@ -22,6 +27,16 @@ const mobile = computed(() => [...known.value].sort((a, b) => a.mobileSort - b.m
|
|||
|
||||
<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>
|
||||
|
|
@ -48,5 +63,6 @@ const mobile = computed(() => [...known.value].sort((a, b) => a.mobileSort - b.m
|
|||
<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>
|
||||
|
|
|
|||
357
resources/js/pages/HomepageEditor.vue
Normal file
357
resources/js/pages/HomepageEditor.vue
Normal file
|
|
@ -0,0 +1,357 @@
|
|||
<script setup>
|
||||
import { computed, onBeforeUnmount, onMounted, provide, reactive, ref, watch } from 'vue';
|
||||
import { Head } from '@inertiajs/vue3';
|
||||
import { ArrowLeft, CircleCheck, CloudAlert, Eye, History, LoaderCircle, Monitor, Plus, Send, Smartphone, Tablet, Undo2 } from '@lucide/vue';
|
||||
import { toast } from 'vue-sonner';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Toaster } from '@/components/ui/sonner';
|
||||
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger } from '@/components/ui/dropdown-menu';
|
||||
import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet';
|
||||
import BlockPalette from '@/pagebuilder/editor/BlockPalette.vue';
|
||||
import BlockSettings from '@/pagebuilder/editor/BlockSettings.vue';
|
||||
import EditorBlockList from '@/pagebuilder/editor/EditorBlockList.vue';
|
||||
import { clone, createBlock, duplicate as duplicateBlock, locate, walk } from '@/pagebuilder/editor/tree';
|
||||
import MediaPickerHost from '@/components/media/MediaPickerHost.vue';
|
||||
import { collectImagePaths, uploadWithProgress } from '@/components/media/api';
|
||||
import { useMediaPicker } from '@/components/media/useMediaPicker';
|
||||
import { http } from '@/lib/http';
|
||||
|
||||
/**
|
||||
* Frei gestaltete Startseite: derselbe Baukasten wie bei Seiten, dazu jede
|
||||
* Startseiten-Kachel als Block. Entwurf wird laufend gespeichert, sichtbar erst
|
||||
* nach „Veröffentlichen“.
|
||||
*/
|
||||
const props = defineProps({
|
||||
content: { type: Object, required: true },
|
||||
state: { type: Object, required: true },
|
||||
revisions: { type: Array, default: () => [] },
|
||||
blockTypes: { type: Array, required: true },
|
||||
blockGroups: { type: Object, required: true },
|
||||
audienceOptions: { type: Object, required: true },
|
||||
uploadsUrl: { type: String, required: true },
|
||||
});
|
||||
|
||||
const base = '/startseite/gestalten';
|
||||
const types = Object.fromEntries(props.blockTypes.map((type) => [type.key, type]));
|
||||
|
||||
const working = reactive({ content: clone(props.content) });
|
||||
const state = ref(props.state);
|
||||
const revisions = ref(props.revisions);
|
||||
const selectedId = ref(null);
|
||||
const hoveredId = ref(null);
|
||||
const previews = reactive({});
|
||||
const sidebarTab = ref('blocks');
|
||||
const sheetOpen = ref(false);
|
||||
const device = ref('desktop');
|
||||
|
||||
const selected = computed(() => (selectedId.value ? locate(working.content.blocks, selectedId.value)?.block ?? null : null));
|
||||
watch(selectedId, (id) => (sidebarTab.value = id ? 'block' : 'blocks'));
|
||||
|
||||
const select = (id) => (selectedId.value = id ?? null);
|
||||
|
||||
function insert(list, index, type) {
|
||||
const block = createBlock(type);
|
||||
list.splice(index, 0, block);
|
||||
select(block.id);
|
||||
}
|
||||
|
||||
function insertFromPalette(type) {
|
||||
const found = selected.value ? locate(working.content.blocks, selected.value.id) : null;
|
||||
found ? insert(found.list, found.index + 1, type) : insert(working.content.blocks, working.content.blocks.length, type);
|
||||
sheetOpen.value = false;
|
||||
}
|
||||
|
||||
function remove(id) {
|
||||
const found = locate(working.content.blocks, id);
|
||||
|
||||
if (!found) return;
|
||||
|
||||
found.list.splice(found.index, 1);
|
||||
|
||||
if (selectedId.value === id) select(null);
|
||||
}
|
||||
|
||||
function move(id, direction) {
|
||||
const found = locate(working.content.blocks, id);
|
||||
const target = found ? found.index + direction : -1;
|
||||
|
||||
if (found && target >= 0 && target < found.list.length) {
|
||||
found.list.splice(target, 0, found.list.splice(found.index, 1)[0]);
|
||||
}
|
||||
}
|
||||
|
||||
function duplicate(id) {
|
||||
const found = locate(working.content.blocks, id);
|
||||
|
||||
if (!found) return;
|
||||
|
||||
const copy = duplicateBlock(found.block);
|
||||
found.list.splice(found.index + 1, 0, copy);
|
||||
Object.assign(previews, { [copy.id]: previews[id] });
|
||||
select(copy.id);
|
||||
}
|
||||
|
||||
function containsActive(item) {
|
||||
const candidates = [selected.value, hoveredId.value ? locate(working.content.blocks, hoveredId.value)?.block : null].filter(Boolean);
|
||||
|
||||
return candidates.some((block) => block.items?.includes(item) || locate(item.blocks, block.id));
|
||||
}
|
||||
|
||||
const uploadImage = (file, onProgress) => uploadWithProgress(`${base}/bilder`, file, { onProgress });
|
||||
const mediaPicker = useMediaPicker({ upload: uploadImage, contextLabel: 'Auf der Startseite', contextPaths: () => collectImagePaths(working.content) });
|
||||
|
||||
provide('pagebuilder:editor', {
|
||||
types,
|
||||
groups: props.blockGroups,
|
||||
selectedId,
|
||||
hoveredId,
|
||||
previews,
|
||||
readOnly: ref(false),
|
||||
files: ref([]),
|
||||
peopleCache: reactive({}),
|
||||
audienceOptions: props.audienceOptions,
|
||||
select,
|
||||
insert,
|
||||
remove,
|
||||
move,
|
||||
duplicate,
|
||||
containsActive,
|
||||
uploadImage,
|
||||
uploadFile: () => Promise.reject(new Error('Dateien zum Herunterladen gehören zu einer Seite – bitte dort hochladen und verlinken.')),
|
||||
pickMedia: (options) => mediaPicker.pick(options),
|
||||
imageUrl: (path) => `${props.uploadsUrl}/${path}`,
|
||||
saveAsSnippet: null,
|
||||
});
|
||||
provide('pagebuilder:list', EditorBlockList);
|
||||
provide('pagebuilder:types', types);
|
||||
provide('pagebuilder:editing', computed(() => true));
|
||||
|
||||
// Vorschau dynamischer Blöcke (Kacheln, Neuigkeiten …) mit den eigenen Daten
|
||||
const previewHashes = {};
|
||||
let previewTimer;
|
||||
|
||||
function refreshPreviews() {
|
||||
const changed = [];
|
||||
|
||||
walk(working.content.blocks, (block) => {
|
||||
if (!types[block.type]?.dynamic) return;
|
||||
|
||||
const hash = JSON.stringify(block.data);
|
||||
|
||||
if (previewHashes[block.id] !== hash) {
|
||||
previewHashes[block.id] = hash;
|
||||
changed.push({ id: block.id, type: block.type, data: block.data });
|
||||
}
|
||||
});
|
||||
|
||||
if (changed.length) {
|
||||
http.post(`${base}/vorschau`, { blocks: changed.slice(0, 100) }).then((data) => Object.assign(previews, data.props)).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
// Entwurf laufend speichern
|
||||
const saveState = ref('saved');
|
||||
let lastSaved = JSON.stringify(working.content);
|
||||
let saveTimer;
|
||||
|
||||
async function save() {
|
||||
clearTimeout(saveTimer);
|
||||
const snapshot = JSON.stringify(working.content);
|
||||
|
||||
if (snapshot === lastSaved) {
|
||||
saveState.value = 'saved';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
saveState.value = 'saving';
|
||||
|
||||
try {
|
||||
const data = await http.put(`${base}/entwurf`, { content: working.content });
|
||||
lastSaved = snapshot;
|
||||
state.value = data.state;
|
||||
saveState.value = JSON.stringify(working.content) === lastSaved ? 'saved' : 'dirty';
|
||||
} catch (error) {
|
||||
saveState.value = 'error';
|
||||
toast.error(error.message || 'Speichern fehlgeschlagen');
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => working.content, () => {
|
||||
saveState.value = 'dirty';
|
||||
clearTimeout(saveTimer);
|
||||
saveTimer = setTimeout(save, 1200);
|
||||
clearTimeout(previewTimer);
|
||||
previewTimer = setTimeout(refreshPreviews, 500);
|
||||
}, { deep: true });
|
||||
|
||||
function applyContent(content) {
|
||||
working.content = clone(content);
|
||||
lastSaved = JSON.stringify(working.content);
|
||||
Object.keys(previewHashes).forEach((key) => delete previewHashes[key]);
|
||||
select(null);
|
||||
setTimeout(() => (saveState.value = 'saved'));
|
||||
refreshPreviews();
|
||||
}
|
||||
|
||||
// Aktionen
|
||||
const publishing = ref(false);
|
||||
|
||||
async function publish() {
|
||||
const activate = state.value.mode !== 'builder';
|
||||
|
||||
if (activate && !window.confirm('Veröffentlichen und die frei gestaltete Startseite für alle einschalten? Die bisherige Kachel-Startseite bleibt erhalten und lässt sich im Backend unter „Startseite“ wieder wählen.')) return;
|
||||
|
||||
publishing.value = true;
|
||||
|
||||
try {
|
||||
const data = await http.post(`${base}/veroeffentlichen`, { content: working.content, activate });
|
||||
lastSaved = JSON.stringify(working.content);
|
||||
state.value = data.state;
|
||||
revisions.value = data.revisions;
|
||||
saveState.value = 'saved';
|
||||
toast.success(activate ? 'Veröffentlicht – die Startseite ist jetzt frei gestaltet.' : 'Veröffentlicht – die Startseite ist aktualisiert.');
|
||||
} catch (error) {
|
||||
toast.error(error.message);
|
||||
} finally {
|
||||
publishing.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function discard() {
|
||||
if (!window.confirm('Alle Änderungen seit der letzten Veröffentlichung verwerfen?')) return;
|
||||
|
||||
const data = await http.delete(`${base}/entwurf`);
|
||||
state.value = data.state;
|
||||
applyContent(data.content);
|
||||
toast.success('Entwurf verworfen');
|
||||
}
|
||||
|
||||
async function restore(revision) {
|
||||
if (!window.confirm('Diese frühere Fassung als Entwurf zurückholen? Veröffentlicht wird sie erst mit „Veröffentlichen“.')) return;
|
||||
|
||||
const data = await http.post(`${base}/versionen/${revision.id}/wiederherstellen`);
|
||||
state.value = data.state;
|
||||
applyContent(data.content);
|
||||
toast.success('Frühere Fassung als Entwurf geladen');
|
||||
}
|
||||
|
||||
async function openPreview() {
|
||||
await save();
|
||||
window.open('/?entwurf=1', '_blank');
|
||||
}
|
||||
|
||||
const devices = [
|
||||
{ key: 'desktop', label: 'Desktop', icon: Monitor, width: 'max-w-[1400px]' },
|
||||
{ key: 'tablet', label: 'Tablet', icon: Tablet, width: 'max-w-[768px]' },
|
||||
{ key: 'mobile', label: 'Smartphone', icon: Smartphone, width: 'max-w-[390px]' },
|
||||
];
|
||||
const canvasWidth = computed(() => devices.find((d) => d.key === device.value).width);
|
||||
const dateTime = new Intl.DateTimeFormat('de-DE', { dateStyle: 'medium', timeStyle: 'short' });
|
||||
|
||||
const warnUnsaved = (event) => saveState.value === 'dirty' && event.preventDefault();
|
||||
|
||||
onMounted(() => {
|
||||
refreshPreviews();
|
||||
window.addEventListener('beforeunload', warnUnsaved);
|
||||
});
|
||||
onBeforeUnmount(() => window.removeEventListener('beforeunload', warnUnsaved));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head title="Startseite gestalten" />
|
||||
|
||||
<div class="flex h-dvh flex-col bg-background">
|
||||
<header class="flex shrink-0 items-center gap-3 border-b bg-card px-3 py-2 sm:px-4">
|
||||
<a href="/admin/startseite" class="grid size-9 place-items-center rounded-md text-muted-foreground hover:bg-accent" aria-label="Zurück ins Backend"><ArrowLeft class="size-5" /></a>
|
||||
<div class="min-w-0 flex-1">
|
||||
<p class="truncate text-sm font-semibold">Startseite gestalten</p>
|
||||
<p class="flex items-center gap-1.5 text-xs text-muted-foreground">
|
||||
<LoaderCircle v-if="saveState === 'saving'" class="size-3 animate-spin" />
|
||||
<CloudAlert v-else-if="saveState === 'error'" class="size-3 text-destructive" />
|
||||
<CircleCheck v-else class="size-3" />
|
||||
<span v-if="saveState === 'error'">Nicht gespeichert</span>
|
||||
<span v-else-if="saveState !== 'saved'">Entwurf wird gespeichert …</span>
|
||||
<span v-else-if="state.has_draft">Entwurf gespeichert – noch nicht veröffentlicht</span>
|
||||
<span v-else-if="!state.published">Noch nicht veröffentlicht – Ausgangspunkt ist die heutige Startseite</span>
|
||||
<span v-else>Veröffentlicht</span>
|
||||
<span class="hidden sm:inline">· Startseite zeigt derzeit: {{ state.mode === 'builder' ? 'diese Gestaltung' : 'Kacheln (wie bisher)' }}</span>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="hidden items-center rounded-md border p-0.5 md:flex" role="group" aria-label="Geräte-Vorschau">
|
||||
<button v-for="d in devices" :key="d.key" type="button" class="grid size-8 place-items-center rounded" :class="device === d.key ? 'bg-muted text-foreground' : 'text-muted-foreground hover:text-foreground'" :title="d.label" :aria-pressed="device === d.key" @click="device = d.key">
|
||||
<component :is="d.icon" class="size-4" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<Button variant="outline" size="icon" class="lg:hidden" aria-label="Block hinzufügen" @click="sheetOpen = true"><Plus /></Button>
|
||||
<Button variant="outline" class="hidden sm:inline-flex" @click="openPreview"><Eye /> Vorschau</Button>
|
||||
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child><Button variant="outline" size="icon" aria-label="Versionen und mehr"><History /></Button></DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-72">
|
||||
<DropdownMenuItem v-if="state.has_draft && state.published" @select="discard"><Undo2 /> Entwurf verwerfen</DropdownMenuItem>
|
||||
<DropdownMenuSeparator v-if="state.has_draft && state.published" />
|
||||
<DropdownMenuLabel class="text-xs text-muted-foreground">Frühere Fassungen</DropdownMenuLabel>
|
||||
<DropdownMenuItem v-for="revision in revisions" :key="revision.id" @select="restore(revision)">
|
||||
<History /> {{ dateTime.format(new Date(revision.at)) }}<span class="ml-auto truncate text-xs text-muted-foreground">{{ revision.user }}</span>
|
||||
</DropdownMenuItem>
|
||||
<p v-if="!revisions.length" class="px-2 py-1.5 text-[13px] text-muted-foreground">Noch nichts veröffentlicht.</p>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
<Button :disabled="publishing" @click="publish"><LoaderCircle v-if="publishing" class="animate-spin" /><Send v-else /> <span class="hidden sm:inline">Veröffentlichen</span></Button>
|
||||
</header>
|
||||
|
||||
<div class="flex min-h-0 flex-1">
|
||||
<main class="min-w-0 flex-1 overflow-y-auto bg-muted/40" @click="select(null)">
|
||||
<div class="mx-auto px-4 py-8 transition-[max-width] duration-300 sm:px-6" :class="canvasWidth">
|
||||
<p v-if="!working.content.blocks.length" class="rounded-lg border border-dashed bg-card p-8 text-center text-sm text-muted-foreground">
|
||||
Leere Startseite – rechts Blöcke wählen, z. B. „Spalten“ und darin „Neuigkeiten“ oder „Kachel“.
|
||||
</p>
|
||||
<div class="@container">
|
||||
<EditorBlockList :item="working.content" root />
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<aside class="hidden w-[340px] shrink-0 flex-col border-l bg-card lg:flex">
|
||||
<div class="flex shrink-0 border-b px-2" role="tablist">
|
||||
<button
|
||||
v-for="tab in [{ key: 'blocks', label: 'Blöcke' }, { key: 'block', label: 'Ausgewählter Block' }]"
|
||||
:key="tab.key"
|
||||
type="button"
|
||||
role="tab"
|
||||
class="relative px-3 py-3 text-sm font-medium disabled:opacity-40"
|
||||
:class="sidebarTab === tab.key ? 'text-foreground' : 'text-muted-foreground hover:text-foreground'"
|
||||
:aria-selected="sidebarTab === tab.key"
|
||||
:disabled="tab.key === 'block' && !selected"
|
||||
@click="sidebarTab = tab.key"
|
||||
>
|
||||
{{ tab.label }}
|
||||
<span v-if="sidebarTab === tab.key" class="absolute inset-x-2 bottom-0 h-[3px] rounded-t-full bg-brand" />
|
||||
</button>
|
||||
</div>
|
||||
<div class="min-h-0 flex-1 overflow-y-auto p-4">
|
||||
<BlockSettings v-if="sidebarTab === 'block' && selected" :key="selected.id" :block="selected" />
|
||||
<template v-else>
|
||||
<p class="mb-4 text-xs text-muted-foreground">Unter „Startseite“ stehen alle Kacheln als Block bereit. Jeder Block lässt sich über „Sichtbarkeit“ auf Rollen, Abteilungen oder Standorte beschränken.</p>
|
||||
<BlockPalette @pick="insertFromPalette" />
|
||||
</template>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<Sheet v-model:open="sheetOpen">
|
||||
<SheetContent side="right" class="w-[340px] overflow-y-auto p-4">
|
||||
<SheetHeader class="p-0"><SheetTitle>{{ selected ? 'Block bearbeiten' : 'Block hinzufügen' }}</SheetTitle></SheetHeader>
|
||||
<BlockSettings v-if="selected" :key="selected.id" :block="selected" />
|
||||
<BlockPalette v-else @pick="insertFromPalette" />
|
||||
</SheetContent>
|
||||
</Sheet>
|
||||
</div>
|
||||
|
||||
<MediaPickerHost :picker="mediaPicker" />
|
||||
<Toaster position="bottom-left" />
|
||||
</template>
|
||||
Loading…
Add table
Add a link
Reference in a new issue