44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
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";
|
||
|
||
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")
|
||
);
|
||
|
||
if (isReady) {
|
||
redirect(ZOO_MODELING_APP_SRC);
|
||
}
|
||
|
||
return (
|
||
<main className="flex h-svh w-full items-center justify-center bg-[#10100e] p-6 text-[#f8f6ef]">
|
||
<section className="w-full max-w-xl rounded-lg border border-[#3a352c] bg-[#171510] p-6 shadow-2xl">
|
||
<h1 className="font-semibold text-lg">HiCAD 官方前端尚未构建</h1>
|
||
<p className="mt-2 text-[#d3cabb] text-sm leading-6">
|
||
请运行
|
||
<code className="mx-1 rounded bg-white/10 px-1.5 py-0.5">
|
||
pnpm zoo-modeling-app:vendor
|
||
</code>
|
||
生成官方前端,然后刷新本页。
|
||
</p>
|
||
</section>
|
||
</main>
|
||
);
|
||
}
|