Files
community-rule/app/create/[screenId]/page.tsx
T
2026-04-14 09:22:03 -06:00

34 lines
836 B
TypeScript

"use client";
import { notFound, useRouter } from "next/navigation";
import { use, useEffect } from "react";
import { CreateFlowScreenView } from "../screens/CreateFlowScreenView";
import { isValidStep } from "../utils/flowSteps";
import type { CreateFlowStep } from "../types";
interface PageProps {
params: Promise<{ screenId: string }>;
}
export default function CreateFlowScreenPage({ params }: PageProps) {
const { screenId: raw } = use(params);
const router = useRouter();
useEffect(() => {
if (raw === "community-reflection") {
router.replace("/create/community-save");
}
}, [raw, router]);
if (raw === "community-reflection") {
return null;
}
if (!isValidStep(raw)) {
notFound();
}
const screenId = raw as CreateFlowStep;
return <CreateFlowScreenView screenId={screenId} />;
}