33 lines
850 B
TypeScript
33 lines
850 B
TypeScript
import { existsSync } from "node:fs";
|
|
import path from "node:path";
|
|
import type { Metadata } from "next";
|
|
import { redirect } from "next/navigation";
|
|
import { auth } from "@/app/(auth)/auth";
|
|
import { ZooDesignStudioFrame } from "@/components/ai-cad/zoo-design-studio-frame";
|
|
|
|
const ZOO_MODELING_APP_SRC = "/vendor/zoo-modeling-app/index.html";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export const metadata: Metadata = {
|
|
title: "HiCAD",
|
|
};
|
|
export const runtime = "nodejs";
|
|
|
|
export default async function AiCadPage() {
|
|
const session = await auth();
|
|
if (!session?.user?.id) {
|
|
redirect("/login?callbackUrl=%2Fai-cad");
|
|
}
|
|
|
|
const isReady = existsSync(
|
|
path.join(process.cwd(), "public/vendor/zoo-modeling-app/index.html")
|
|
);
|
|
|
|
return (
|
|
<ZooDesignStudioFrame
|
|
isReady={isReady}
|
|
src={ZOO_MODELING_APP_SRC}
|
|
/>
|
|
);
|
|
}
|