feat : comment feature
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import { CommentBoardSkeleton } from "@/components/comments/comment-skeleton";
|
||||
|
||||
export default function Loading() {
|
||||
return <div className="mx-auto w-full max-w-7xl p-4 sm:p-6 lg:p-10"><CommentBoardSkeleton /></div>;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import { connection } from "next/server";
|
||||
import { redirect } from "next/navigation";
|
||||
import { AdminHeader } from "@/components/admin/admin-header";
|
||||
import { AdminCommentInbox } from "@/components/comments/admin-comment-inbox";
|
||||
import { getCommentViewer, listComments, listCommentTargets } from "@/lib/comments/repository";
|
||||
|
||||
export default async function AdminCommentsPage({ searchParams }: { searchParams: Promise<{ target?: string }> }) {
|
||||
await connection();
|
||||
const viewer = await getCommentViewer();
|
||||
if (!viewer?.admin) redirect("/auth/login?next=%2Fadmin%2Fcomments");
|
||||
const initialTarget = (await searchParams).target;
|
||||
const [initial, targets] = await Promise.all([listComments({ viewer, inbox: true, target: initialTarget }), listCommentTargets()]);
|
||||
return <><AdminHeader /><main className="mx-auto flex w-full max-w-7xl flex-col gap-6 p-4 sm:p-6 lg:p-8">
|
||||
<header><h1 className="font-heading text-3xl font-semibold">ความคิดเห็น</h1><p className="mt-2 text-muted-foreground">ตอบกลับและจัดการความคิดเห็นจากทุกไกด์</p></header>
|
||||
<AdminCommentInbox key={initialTarget ?? "all"} initialTarget={initialTarget} initial={initial} targets={targets} />
|
||||
</main></>;
|
||||
}
|
||||
Reference in New Issue
Block a user