From d3a33aed823f2efbd81c78900a8982b5640c8306 Mon Sep 17 00:00:00 2001 From: Oliver Baer Date: Sat, 11 Jul 2026 14:19:53 +0200 Subject: [PATCH 1/2] zahl raus --- src/components/noir/sections/NoirDonateSection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/noir/sections/NoirDonateSection.tsx b/src/components/noir/sections/NoirDonateSection.tsx index 698f2bc..caecac2 100644 --- a/src/components/noir/sections/NoirDonateSection.tsx +++ b/src/components/noir/sections/NoirDonateSection.tsx @@ -37,7 +37,7 @@ export default function NoirDonateSection({ content }: { content?: NoirDonateCon
Tickets

KombiTicket – beide Nächte

- Online buchen per PayPal. An der Abendkasse gilt: zahl, was du kannst – kein Mindestpreis. + Online buchen per PayPal.

Date: Sat, 11 Jul 2026 14:23:55 +0200 Subject: [PATCH 2/2] feat(sections): seed an editable homepage FAQ from the defaults The homepage's auto-generated FAQ only appears while no `faq` section exists, and editing it meant retyping every Q&A by hand. Add a "FAQ aus Vorlage" action (shown until a faq section exists) that pre-fills the add-form with the current default questions/answers for review, then saves via the normal create flow. - faq.ts: shared HOMEPAGE_FAQ_TITLE/SUBTITLE + pure resolveFestivalFaq() (unit-tested); homepage page.tsx now uses it instead of inline logic. - GET /api/admin/sections/faq-defaults returns the computed defaults. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app/(public)/page.tsx | 18 +++------- src/app/admin/sections/page.tsx | 34 +++++++++++++++++++ .../api/admin/sections/faq-defaults/route.ts | 27 +++++++++++++++ src/lib/__tests__/faq.test.ts | 28 ++++++++++++++- src/lib/faq.ts | 20 +++++++++++ 5 files changed, 112 insertions(+), 15 deletions(-) create mode 100644 src/app/api/admin/sections/faq-defaults/route.ts diff --git a/src/app/(public)/page.tsx b/src/app/(public)/page.tsx index 83ea747..28cdf2f 100644 --- a/src/app/(public)/page.tsx +++ b/src/app/(public)/page.tsx @@ -8,7 +8,7 @@ import { getHomepageSections } from '@/lib/sections' import { NOIR_DEFAULT_LAYOUT } from '@/lib/noir-home-defaults' import FAQ from '@/components/sections/FAQ' import { getFeaturedEvent } from '@/lib/events' -import { festivalFaqDefaults, formatFestivalDateLabel } from '@/lib/faq' +import { resolveFestivalFaq } from '@/lib/faq' export const dynamic = 'force-dynamic' @@ -55,17 +55,13 @@ export default async function HomePage() { // SectionStructuredData render + emit on their own). This guarantees exactly // one visible FAQ and one FAQPage in every layout. const hasDbFaq = sections.some((s) => s.type === 'faq' && s.isVisible) - const dateLabel = featured - ? formatFestivalDateLabel(featured.startDate, featured.endDate) - : '7. und 8. August 2026' - const location = featured?.locationName || 'Hof Thiele, Ventschau' - const faqItems = festivalFaqDefaults({ dateLabel, location }) + const faq = resolveFestivalFaq(featured) return (
{festivalJsonLd && } - {!hasDbFaq && } + {!hasDbFaq && } {sections.length > 0 ? ( // Editor-composed homepage: ordered/visible elements from /admin/sections @@ -75,13 +71,7 @@ export default async function HomePage() { NOIR_DEFAULT_LAYOUT.map((type) => ) )} {!hasDbFaq && ( - + )}
) diff --git a/src/app/admin/sections/page.tsx b/src/app/admin/sections/page.tsx index d904c13..10c4b57 100644 --- a/src/app/admin/sections/page.tsx +++ b/src/app/admin/sections/page.tsx @@ -1078,6 +1078,30 @@ export default function AdminSectionsPage() { } } + // Pre-fill the add-form with the current default homepage FAQ so an editor can + // review and save it as a real, editable `faq` section. Nothing is persisted + // until they hit Speichern (the normal create flow). + async function seedFaqFromDefaults() { + setError(null) + try { + const res = await fetch('/api/admin/sections/faq-defaults') + if (!res.ok) throw new Error('FAQ-Vorlage konnte nicht geladen werden') + const data = await res.json() + resetForm() + setFormType('faq') + setFormTitle(data.title || '') + setFormSubtitle(data.subtitle || '') + setFaqItems( + Array.isArray(data.items) && data.items.length > 0 + ? data.items + : [{ question: '', answer: '' }], + ) + setShowAddForm(true) + } catch (err) { + setError(err instanceof Error ? err.message : 'Fehler') + } + } + // --------------------------------------------------------------------------- // Section list detail helpers // --------------------------------------------------------------------------- @@ -1233,6 +1257,16 @@ export default function AdminSectionsPage() { Aktuelle Startseite übernehmen )} + {!sections.some((s) => s.type === 'faq') && ( + + )}