- Planungen mit Art, Status (Idee → In Arbeit → Zur Freigabe → Geplant → Erledigt), Zuständigkeit, Erscheinungstag, Frist, Notizen und Kommentaren - Monatsansicht mit Planungen, Meldungen (online/geplant/Entwurf) und Terminen; Verschieben per Ziehen & Ablegen oder im Dialog (Tastatur) - Ideenspeicher für Planungen ohne Datum - Board nach Status mit Ziehen & Ablegen, Listenansicht mit Tabelle - Filter nach Person („Nur meine“), Art und erledigten Einträgen - „Meldung daraus erstellen“ legt einen verknüpften Entwurf an - „Meine Aufgaben“ auf der Übersicht, überfällige Fristen hervorgehoben - Demo-Planungen im Seed Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
97 lines
4.7 KiB
Svelte
97 lines
4.7 KiB
Svelte
<script lang="ts">
|
|
import Newspaper from '@lucide/svelte/icons/newspaper';
|
|
import CalendarDays from '@lucide/svelte/icons/calendar-days';
|
|
import DoorClosed from '@lucide/svelte/icons/door-closed';
|
|
import MessageSquare from '@lucide/svelte/icons/message-square';
|
|
import AlarmClock from '@lucide/svelte/icons/alarm-clock';
|
|
import Link2 from '@lucide/svelte/icons/link-2';
|
|
import { EDITORIAL_KINDS, EDITORIAL_STATUS, STATUS_TONE, type CalendarEntry, type TeamMember } from '$lib/editorial';
|
|
import { formatShort } from '$lib/dates';
|
|
|
|
let {
|
|
entry,
|
|
team,
|
|
today,
|
|
onopen,
|
|
compact = false
|
|
}: { entry: CalendarEntry; team: TeamMember[]; today: string; onopen: (e: CalendarEntry) => void; compact?: boolean } = $props();
|
|
|
|
const assignee = $derived(entry.type === 'plan' ? team.find((m) => m.id === entry.assigneeId) : undefined);
|
|
const overdue = $derived(entry.type === 'plan' && !!entry.dueDate && entry.dueDate < today && entry.status !== 'done');
|
|
const draggable = $derived(entry.type === 'plan' || (entry.type === 'post' && !entry.live));
|
|
|
|
/** Vollständige Beschreibung für Screenreader */
|
|
const label = $derived.by(() => {
|
|
if (entry.type === 'plan')
|
|
return [
|
|
`Planung: ${entry.title}`,
|
|
EDITORIAL_KINDS[entry.kind],
|
|
`Status ${EDITORIAL_STATUS[entry.status]}`,
|
|
assignee ? `zuständig ${assignee.name}` : 'niemand zuständig',
|
|
entry.dueDate ? `Frist ${formatShort(entry.dueDate)}${overdue ? ', überfällig' : ''}` : '',
|
|
entry.commentCount ? `${entry.commentCount} Kommentare` : ''
|
|
]
|
|
.filter(Boolean)
|
|
.join(', ');
|
|
if (entry.type === 'post')
|
|
return `Meldung: ${entry.title}, ${entry.live ? 'veröffentlicht' : entry.published ? `geplant um ${entry.time} Uhr` : 'Entwurf'}`;
|
|
return `${entry.closure ? 'Schließzeit' : 'Termin'}: ${entry.title}`;
|
|
});
|
|
|
|
function dragstart(e: DragEvent) {
|
|
e.dataTransfer?.setData('application/x-redaktion', JSON.stringify({ type: entry.type, id: entry.id }));
|
|
if (e.dataTransfer) e.dataTransfer.effectAllowed = 'move';
|
|
}
|
|
</script>
|
|
|
|
{#if entry.type === 'plan'}
|
|
<button
|
|
type="button"
|
|
{draggable}
|
|
ondragstart={dragstart}
|
|
onclick={() => onopen(entry)}
|
|
aria-label={label}
|
|
class="tone-{STATUS_TONE[entry.status]} group w-full text-left rounded-lg bg-surface border border-line border-l-4 border-l-tone px-2 py-1.5 hover:border-brand/40 hover:shadow-card transition cursor-grab active:cursor-grabbing {entry.status === 'done' ? 'opacity-60' : ''}"
|
|
>
|
|
<span class="flex items-start gap-1.5">
|
|
<span class="flex-1 min-w-0 text-[0.8rem] font-semibold leading-snug {compact ? 'line-clamp-2' : ''} {entry.status === 'done' ? 'line-through' : ''}">{entry.title}</span>
|
|
{#if assignee}
|
|
<span class="grid place-items-center size-5 rounded-full bg-brand text-on-brand text-[0.6rem] font-bold shrink-0" aria-hidden="true" title={assignee.name}>{assignee.initials}</span>
|
|
{/if}
|
|
</span>
|
|
<span class="flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-1 text-[0.7rem] text-ink-3" aria-hidden="true">
|
|
<span class="font-semibold text-tone-ink">{EDITORIAL_STATUS[entry.status]}</span>
|
|
{#if !compact}<span>{EDITORIAL_KINDS[entry.kind]}</span>{/if}
|
|
{#if entry.dueDate}
|
|
<span class="inline-flex items-center gap-0.5 {overdue ? 'text-danger font-bold' : ''}"><AlarmClock class="size-3" />{formatShort(entry.dueDate).slice(0, 6)}</span>
|
|
{/if}
|
|
{#if entry.commentCount}<span class="inline-flex items-center gap-0.5"><MessageSquare class="size-3" />{entry.commentCount}</span>{/if}
|
|
{#if entry.postId || entry.pageId}<Link2 class="size-3" />{/if}
|
|
</span>
|
|
</button>
|
|
{:else if entry.type === 'post'}
|
|
<button
|
|
type="button"
|
|
{draggable}
|
|
ondragstart={dragstart}
|
|
onclick={() => onopen(entry)}
|
|
aria-label={label}
|
|
class="w-full text-left rounded-lg px-2 py-1.5 text-[0.8rem] leading-snug transition {entry.live ? 'bg-brand text-on-brand' : 'bg-brand-soft text-brand-ink border border-dashed border-brand/40'} {draggable ? 'cursor-grab active:cursor-grabbing' : ''}"
|
|
>
|
|
<span class="flex items-start gap-1.5">
|
|
<Newspaper class="size-3.5 mt-0.5 shrink-0" />
|
|
<span class="flex-1 min-w-0 font-semibold {compact ? 'line-clamp-2' : ''}">{entry.title}</span>
|
|
</span>
|
|
<span class="block text-[0.7rem] opacity-80 mt-0.5" aria-hidden="true">{entry.live ? 'Online' : entry.published ? `Geplant · ${entry.time}` : 'Entwurf'}</span>
|
|
</button>
|
|
{:else}
|
|
<button
|
|
type="button"
|
|
onclick={() => onopen(entry)}
|
|
aria-label={label}
|
|
class="w-full text-left flex items-center gap-1.5 rounded-lg px-2 py-1 text-[0.75rem] {entry.closure ? 'bg-accent-soft text-accent-ink' : 'text-ink-2 hover:bg-surface-2'}"
|
|
>
|
|
{#if entry.closure}<DoorClosed class="size-3.5 shrink-0" />{:else}<CalendarDays class="size-3.5 shrink-0" />{/if}
|
|
<span class="truncate">{entry.title}</span>
|
|
</button>
|
|
{/if}
|