mirror of
https://github.com/Since-3/since3-portal.git
synced 2026-10-12 19:51:17 +00:00
30 lines
1.3 KiB
TypeScript
30 lines
1.3 KiB
TypeScript
import type { Metadata } from "next"
|
|
import { notFound, redirect } from "next/navigation"
|
|
import { verifySession } from "@/lib/supabase/dal"
|
|
import { demoInfo } from "@/modules/templates/ai/demo-info"
|
|
import { isDemoSlug } from "@/modules/templates/ai/demos"
|
|
import { AiDemo } from "@/modules/templates/ai/ui/ai-demo"
|
|
import { resolveContent } from "@/modules/templates/lib/content"
|
|
import { getTemplate } from "@/modules/templates/lib/registry"
|
|
import { getVariant } from "@/modules/templates/queries/variants"
|
|
|
|
export const metadata: Metadata = {
|
|
title: "KI-Demo",
|
|
robots: { index: false, follow: false },
|
|
}
|
|
|
|
// Interne KI-Demo für Admins: alle Demos, ohne Tageslimit, auch ohne Freigabe-Link
|
|
export default async function AdminAiDemoPage({ params }: PageProps<"/ki/[id]/[tool]">) {
|
|
const session = await verifySession()
|
|
if (!session.isAdmin) redirect("/client/dashboard")
|
|
|
|
const { id, tool } = await params
|
|
if (!isDemoSlug(tool)) notFound()
|
|
|
|
const variant = await getVariant(id)
|
|
const def = variant ? getTemplate(variant.template_key) : undefined
|
|
if (!variant || !def) notFound()
|
|
|
|
const content = resolveContent(def, variant.content)
|
|
return <AiDemo tool={tool} access={{ variantId: id }} info={demoInfo(def, content, { siteHref: `/preview/${def.key}?variant=${id}`, all: true })} />
|
|
}
|