initial commit
This commit is contained in:
23
app/posts/[slug]/page.tsx
Normal file
23
app/posts/[slug]/page.tsx
Normal file
@@ -0,0 +1,23 @@
|
||||
import { notFound } from "next/navigation";
|
||||
import PostEditor from "@/components/PostEditor";
|
||||
import { listImages } from "@/lib/images";
|
||||
import { categoryCounts, readPosts, tagCounts } from "@/lib/store";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function EditPostPage({ params }: { params: Promise<{ slug: string }> }) {
|
||||
const { slug } = await params;
|
||||
const { posts, revision } = await readPosts();
|
||||
const post = posts.find((p) => p.slug === slug);
|
||||
if (!post) notFound();
|
||||
|
||||
return (
|
||||
<PostEditor
|
||||
post={post}
|
||||
revision={revision}
|
||||
files={await listImages(slug)}
|
||||
categories={categoryCounts(posts).map((c) => c.name)}
|
||||
tags={tagCounts(posts).map((t) => t.name)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
15
app/posts/new/page.tsx
Normal file
15
app/posts/new/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import PostEditor from "@/components/PostEditor";
|
||||
import { categoryCounts, readPosts, tagCounts } from "@/lib/store";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function NewPostPage() {
|
||||
const { posts, revision } = await readPosts();
|
||||
return (
|
||||
<PostEditor
|
||||
revision={revision}
|
||||
categories={categoryCounts(posts).map((c) => c.name)}
|
||||
tags={tagCounts(posts).map((t) => t.name)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user