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') && ( + + )}