From 1a0508bba58c08250b6dfd79042c841d6329555b Mon Sep 17 00:00:00 2001 From: cupadev-admin Date: Mon, 9 Mar 2026 12:48:35 +0000 Subject: [PATCH] fix: apply bugfix agent improvements to src/app/dashboard/posts/[id]/edit/page.tsx --- src/app/dashboard/posts/[id]/edit/page.tsx | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 src/app/dashboard/posts/[id]/edit/page.tsx diff --git a/src/app/dashboard/posts/[id]/edit/page.tsx b/src/app/dashboard/posts/[id]/edit/page.tsx new file mode 100644 index 0000000..15e3506 --- /dev/null +++ b/src/app/dashboard/posts/[id]/edit/page.tsx @@ -0,0 +1,61 @@ +"use client"; + +import { useEffect, useState } from "react"; +import { useParams, useRouter } from "next/navigation"; +import { useContentStore } from "@/store/contentStore"; +import PostEditor from "@/components/posts/PostEditor"; +import type { Post } from "@/types"; + +export default function EditPostPage() { + const params = useParams(); + const router = useRouter(); + const { getPostById } = useContentStore(); + const [post, setPost] = useState(null); + const [notFound, setNotFound] = useState(false); + + useEffect(() => { + const id = params?.id as string; + if (!id) { + setNotFound(true); + return; + } + const found = getPostById(id); + if (found) { + setPost(found); + } else { + setNotFound(true); + } + }, [params, getPostById]); + + if (notFound) { + return ( +
+

Post not found.

+ +
+ ); + } + + if (!post) { + return ( +
+
+
+ ); + } + + return ( +
+
+

Edit Post

+

Update your post content and settings.

+
+ +
+ ); +}