Add Create page, gated on creator role and ComfyUI

This commit is contained in:
Dan committed 2026-06-29 14:10:56 +00:00
1 parent e918955cda
commit b39bdaaa78
1 file changed
+27
+27
View File
@@ -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&apos;d love to draw and DrawIt will make a brand-new coloring-book lesson for it —