mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 20:51:17 +00:00
50 lines
2.1 KiB
TypeScript
50 lines
2.1 KiB
TypeScript
"use client"
|
|
|
|
import type { ComponentType } from "react"
|
|
import { AiAccessProvider } from "../../ai/access-context"
|
|
import type { AiAccess } from "../../ai/demos"
|
|
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 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,
|
|
}
|
|
|
|
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}>
|
|
<Template content={content} />
|
|
</AiAccessProvider>
|
|
)
|
|
}
|