- Drei Design-Vorlagen (Kreis, Klar, Kacheln) mit Feinschliff: vier gut lesbare Schriften, eckig/rund/sehr rund, Hausfarben mit Live-Kontrastprüfung und „Farbe anpassen“; der Server lehnt zu helle Farben mit Vorschlag ab - Fertige Farbpaare alle mit mindestens 4,5:1 zu Weiß - Markenfarben greifen jetzt zuverlässig (Spezifität der eingebetteten Variablen); dunkle Darstellung wird aus der Hauptfarbe abgeleitet statt fest Indigo - Checkliste „Erste Schritte“ im Dashboard für neue Einrichtungen - Startwerte (APP_NAME, ORG_NAME, BRAND_COLOR, ACCENT_COLOR) beim ersten Start - deploy/: neue-einrichtung.sh, aktualisieren.sh, sichern.sh für eine Installation je Kunde mit gemeinsamem Image - mobile/: KUNDE=<kurzname> baut die App einer Einrichtung aus mobile/kunden/<kurzname>/ inklusive deren Firebase-Dateien Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
132 lines
6.2 KiB
Svelte
132 lines
6.2 KiB
Svelte
<script lang="ts">
|
||
import { goto } from '$app/navigation';
|
||
import { page } from '$app/state';
|
||
import Plus from '@lucide/svelte/icons/plus';
|
||
import ChevronLeft from '@lucide/svelte/icons/chevron-left';
|
||
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
||
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
||
import Columns3 from '@lucide/svelte/icons/columns-3';
|
||
import List from '@lucide/svelte/icons/list';
|
||
import PageHeader from '$lib/admin/PageHeader.svelte';
|
||
import MonthView from '$lib/admin/calendar/MonthView.svelte';
|
||
import BoardView from '$lib/admin/calendar/BoardView.svelte';
|
||
import ListView from '$lib/admin/calendar/ListView.svelte';
|
||
import ItemDialog from '$lib/admin/calendar/ItemDialog.svelte';
|
||
import { EDITORIAL_KINDS, kindKeys, type CalendarEntry, type EditorialStatus } from '$lib/editorial';
|
||
import { formatMonthYear } from '$lib/dates';
|
||
|
||
let { data } = $props();
|
||
|
||
type Plan = Extract<CalendarEntry, { type: 'plan' }>;
|
||
let editing = $state<Plan | null>(null);
|
||
|
||
/** URL-Parameter setzen (Ansicht, Monat, Filter) – ohne Scroll-Sprung */
|
||
function setParam(patch: Record<string, string>) {
|
||
const url = new URL(page.url);
|
||
for (const [k, v] of Object.entries(patch)) v ? url.searchParams.set(k, v) : url.searchParams.delete(k);
|
||
goto(url, { noScroll: true, keepFocus: true });
|
||
}
|
||
|
||
function shiftMonth(delta: number) {
|
||
const [y, m] = data.month.split('-').map(Number);
|
||
const d = new Date(Date.UTC(y, m - 1 + delta, 1));
|
||
setParam({ monat: d.toISOString().slice(0, 7) });
|
||
}
|
||
|
||
function open(entry: CalendarEntry) {
|
||
if (entry.type === 'plan') editing = { ...entry };
|
||
else if (entry.type === 'post') goto(`/admin/meldungen/${entry.id}`);
|
||
else goto(`/admin/termine/${entry.id}`);
|
||
}
|
||
|
||
function create(date: string, status: EditorialStatus = date ? 'ready' : 'idea') {
|
||
editing = {
|
||
type: 'plan', id: 0, title: '', notes: '', kind: 'post', status, date, dueDate: '',
|
||
assigneeId: data.user.id, postId: null, pageId: null, commentCount: 0
|
||
};
|
||
}
|
||
|
||
const views = [
|
||
{ value: 'monat', label: 'Monat', icon: CalendarDays },
|
||
{ value: 'board', label: 'Board', icon: Columns3 },
|
||
{ value: 'liste', label: 'Liste', icon: List }
|
||
] as const;
|
||
</script>
|
||
|
||
<svelte:head><title>Redaktionskalender · {data.brand.appName}</title></svelte:head>
|
||
|
||
<PageHeader title="Redaktionskalender" description="Planen, verteilen und abstimmen – was erscheint wann, und wer kümmert sich?">
|
||
{#snippet actions()}
|
||
<button type="button" class="btn btn-primary" onclick={() => create('')}><Plus class="size-4" />Neue Planung</button>
|
||
{/snippet}
|
||
</PageHeader>
|
||
|
||
<!-- Werkzeugleiste -->
|
||
<div class="flex flex-wrap items-center gap-3 mb-6">
|
||
<nav aria-label="Ansicht" class="inline-flex rounded-pill bg-surface-2 p-1">
|
||
{#each views as v (v.value)}
|
||
<a
|
||
href="?{new URLSearchParams({ ...Object.fromEntries(page.url.searchParams), ansicht: v.value })}"
|
||
class="inline-flex items-center gap-1.5 rounded-pill px-3.5 py-1.5 text-sm font-bold transition {data.view === v.value ? 'bg-surface text-brand-ink shadow-card' : 'text-ink-2 hover:text-ink'}"
|
||
aria-current={data.view === v.value ? 'page' : undefined}
|
||
data-sveltekit-noscroll
|
||
>
|
||
<v.icon class="size-4" />{v.label}
|
||
</a>
|
||
{/each}
|
||
</nav>
|
||
|
||
{#if data.view === 'monat'}
|
||
<div class="inline-flex items-center gap-1">
|
||
<button type="button" class="btn btn-ghost btn-icon btn-sm" aria-label="Vorheriger Monat" onclick={() => shiftMonth(-1)}><ChevronLeft class="size-5" /></button>
|
||
<h2 class="font-bold text-lg min-w-40 text-center" aria-live="polite">{formatMonthYear(`${data.month}-01`)}</h2>
|
||
<button type="button" class="btn btn-ghost btn-icon btn-sm" aria-label="Nächster Monat" onclick={() => shiftMonth(1)}><ChevronRight class="size-5" /></button>
|
||
{#if data.month !== data.today.slice(0, 7)}
|
||
<button type="button" class="btn btn-soft btn-sm ml-1" onclick={() => setParam({ monat: '' })}>Heute</button>
|
||
{/if}
|
||
</div>
|
||
{/if}
|
||
|
||
<div class="flex flex-wrap items-center gap-2 ml-auto">
|
||
<label class="sr-only" for="f-person">Nach Person filtern</label>
|
||
<select id="f-person" class="field min-h-9 py-1 text-sm w-auto" value={data.filters.person} onchange={(e) => setParam({ person: e.currentTarget.value })}>
|
||
<option value="">Alle Personen</option>
|
||
<option value="ich">Nur meine</option>
|
||
{#each data.team as m (m.id)}<option value={String(m.id)}>{m.name}</option>{/each}
|
||
</select>
|
||
<label class="sr-only" for="f-kind">Nach Art filtern</label>
|
||
<select id="f-kind" class="field min-h-9 py-1 text-sm w-auto" value={data.filters.kind} onchange={(e) => setParam({ art: e.currentTarget.value })}>
|
||
<option value="">Alle Arten</option>
|
||
{#each kindKeys as k (k)}<option value={k}>{EDITORIAL_KINDS[k]}</option>{/each}
|
||
</select>
|
||
{#if data.view !== 'board'}
|
||
<label class="inline-flex items-center gap-2 text-sm font-semibold cursor-pointer">
|
||
<input type="checkbox" class="size-4 accent-[var(--brand)]" checked={data.filters.showDone} onchange={(e) => setParam({ erledigt: e.currentTarget.checked ? 'zeigen' : '' })} />
|
||
Erledigte zeigen
|
||
</label>
|
||
{/if}
|
||
</div>
|
||
</div>
|
||
|
||
{#if data.view === 'monat'}
|
||
<MonthView days={data.grid.days} month={data.month} entries={data.entries} ideas={data.ideas} team={data.team} today={data.today} onopen={open} oncreate={(d) => create(d)} />
|
||
<p class="hint mt-4 flex flex-wrap gap-x-5 gap-y-1">
|
||
<span>Einträge per Maus auf einen anderen Tag ziehen – oder öffnen und das Datum ändern.</span>
|
||
<span><span class="inline-block size-2.5 rounded-sm bg-brand align-middle mr-1"></span>Meldung online</span>
|
||
<span><span class="inline-block size-2.5 rounded-sm border border-dashed border-brand bg-brand-soft align-middle mr-1"></span>Meldung geplant / Entwurf</span>
|
||
</p>
|
||
{:else if data.view === 'board'}
|
||
<BoardView plans={data.plans} team={data.team} today={data.today} onopen={open} oncreate={create} />
|
||
<p class="hint mt-2">Karten zwischen den Spalten ziehen, um den Status zu ändern – oder öffnen und den Status wählen.</p>
|
||
{:else}
|
||
<ListView plans={data.plans} team={data.team} today={data.today} onopen={open} />
|
||
{/if}
|
||
|
||
<ItemDialog
|
||
bind:item={editing}
|
||
team={data.team}
|
||
me={data.user.id}
|
||
isAdmin={data.user.role === 'admin'}
|
||
postOptions={data.postOptions}
|
||
pageOptions={data.pageOptions}
|
||
/>
|