Add Create page, gated on creator role and ComfyUI
This commit is contained in:
1 parent
e918955cda
commit
b39bdaaa78
1 file changed
+27
@@ -0,0 +1,27 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import SiteNav from "@/components/SiteNav";
|
||||
import CreateForm from "./CreateForm";
|
||||
import { getCurrentUser, canCreate } from "@/lib/session";
|
||||
import { isCreateEnabled } from "@/lib/comfyui";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const metadata = { title: "Create · DrawIt" };
|
||||
|
||||
export default async function CreatePage({ searchParams }: { searchParams: Promise<{ level?: string }> }) {
|
||||
const user = await getCurrentUser();
|
||||
if (!user) redirect("/login");
|
||||
if (!canCreate(user)) redirect("/learn");
|
||||
// Hide the Create page entirely when ComfyUI isn't configured (Creator role alone isn't enough).
|
||||
if (!isCreateEnabled()) redirect("/learn");
|
||||
|
||||
const { level } = await searchParams;
|
||||
const lvl = level === "beginner" ? "beginner" : "early-beginner";
|
||||
|
||||
return (
|
||||
<>
|
||||
<SiteNav />
|
||||
<main className="container page">
|
||||
<h1>✨ Create your own lesson</h1>
|
||||
<p className="muted" style={{ maxWidth: 640 }}>
|
||||
Type something you'd love to draw and DrawIt will make a brand-new coloring-book lesson for it —
|
||||
|
||||
Reference in new issue
Block a user