mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 19:51:17 +00:00
76 lines
3.6 KiB
TypeScript
76 lines
3.6 KiB
TypeScript
"use client"
|
|
|
|
import type { ComponentType } from "react"
|
|
import { AiAccessProvider } from "../../ai/access-context"
|
|
import type { AiAccess } from "../../ai/demos"
|
|
import { ChatWidget } from "../../ai/ui/chat-widget"
|
|
import { BeautyTemplate } from "../../catalog/beauty/template"
|
|
import { CoachTemplate } from "../../catalog/coach/template"
|
|
import { EventTemplate } from "../../catalog/event/template"
|
|
import { FitnessTemplate } from "../../catalog/fitness/template"
|
|
import { HandwerkTemplate } from "../../catalog/handwerk/template"
|
|
import { ImmobilienTemplate } from "../../catalog/immobilien/template"
|
|
import { KampagneTemplate } from "../../catalog/kampagne/template"
|
|
import { KanzleiTemplate } from "../../catalog/kanzlei/template"
|
|
import { KarriereTemplate } from "../../catalog/karriere/template"
|
|
import { PraxisTemplate } from "../../catalog/praxis/template"
|
|
import { RestaurantTemplate } from "../../catalog/restaurant/template"
|
|
import { SaasTemplate } from "../../catalog/saas/template"
|
|
import { NutzfahrzeugeTemplate } from "../../catalog/nutzfahrzeuge/template"
|
|
import { HotelTemplate } from "../../catalog/hotel/template"
|
|
import { CafeTemplate } from "../../catalog/cafe/template"
|
|
import { FotografTemplate } from "../../catalog/fotograf/template"
|
|
import { PflegeTemplate } from "../../catalog/pflege/template"
|
|
import { ShopTemplate } from "../../catalog/shop/template"
|
|
import { AgenturTemplate } from "../../catalog/agentur/template"
|
|
import { VereinTemplate } from "../../catalog/verein/template"
|
|
import { LinkinbioTemplate } from "../../catalog/linkinbio/template"
|
|
import { SpeisekarteTemplate } from "../../catalog/speisekarte/template"
|
|
import { DemoContext } from "../../catalog/shared/demo"
|
|
import { DemoBadge } from "../../catalog/shared/demo-badge"
|
|
import type { TemplateContent } from "../../lib/types"
|
|
|
|
type TemplateComponent = ComponentType<{ content: TemplateContent }>
|
|
|
|
const components: Record<string, TemplateComponent> = {
|
|
restaurant: RestaurantTemplate as TemplateComponent,
|
|
handwerk: HandwerkTemplate as TemplateComponent,
|
|
beauty: BeautyTemplate as TemplateComponent,
|
|
kanzlei: KanzleiTemplate as TemplateComponent,
|
|
praxis: PraxisTemplate as TemplateComponent,
|
|
fitness: FitnessTemplate as TemplateComponent,
|
|
saas: SaasTemplate as TemplateComponent,
|
|
immobilien: ImmobilienTemplate as TemplateComponent,
|
|
karriere: KarriereTemplate as TemplateComponent,
|
|
kampagne: KampagneTemplate as TemplateComponent,
|
|
event: EventTemplate as TemplateComponent,
|
|
coach: CoachTemplate as TemplateComponent,
|
|
nutzfahrzeuge: NutzfahrzeugeTemplate as TemplateComponent,
|
|
hotel: HotelTemplate as TemplateComponent,
|
|
cafe: CafeTemplate as TemplateComponent,
|
|
fotograf: FotografTemplate as TemplateComponent,
|
|
pflege: PflegeTemplate as TemplateComponent,
|
|
shop: ShopTemplate as TemplateComponent,
|
|
agentur: AgenturTemplate as TemplateComponent,
|
|
verein: VereinTemplate as TemplateComponent,
|
|
linkinbio: LinkinbioTemplate as TemplateComponent,
|
|
speisekarte: SpeisekarteTemplate as TemplateComponent,
|
|
}
|
|
|
|
export function TemplateRenderer({ templateKey, content, access = null }: {
|
|
templateKey: string
|
|
content: TemplateContent
|
|
access?: AiAccess | null
|
|
}) {
|
|
const Template = components[templateKey]
|
|
if (!Template) return null
|
|
|
|
return (
|
|
<AiAccessProvider access={access}>
|
|
{/* Entwurfs-Hinweis und KI-Chat rendert die TemplateShell; ohne diesen Kontext (Export) entfallen sie */}
|
|
<DemoContext value={{ overlay: <><DemoBadge content={content} /><ChatWidget content={content} /></> }}>
|
|
<Template content={content} />
|
|
</DemoContext>
|
|
</AiAccessProvider>
|
|
)
|
|
}
|