Skip to content

Commit

Permalink
feat: implement Comment Board
Browse files Browse the repository at this point in the history
  • Loading branch information
2wheeh committed May 10, 2024
1 parent 31d218d commit 02390fc
Showing 1 changed file with 35 additions and 2 deletions.
37 changes: 35 additions & 2 deletions ui/src/app/(board)/comment/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
export default function Page() {
return <>comment board</>;
import { Suspense } from 'react';

import { CommentBoardHeader } from '@/components/comment/client/comment-board-header';
import { CommentCardsList } from '@/components/comment/server/comment-cards-list';

import { COMMENT_FILTERS } from '@/lib/constants/comment';
import type { ListCommentsQuery } from '@/lib/definitions/comment';

export default function Page({
searchParams,
}: {
searchParams?: Omit<ListCommentsQuery, 'pageOffset' | 'pageSize'> & {
page?: string;
};
}) {
const query: ListCommentsQuery = {
movieName: searchParams?.movieName,
nickname: searchParams?.nickname,
pageOffset: Number(searchParams?.page),
};

const SEARCH_OPEN_KEY = COMMENT_FILTERS.reduce((acc, filter) => acc + (query[filter] ?? ''), '');

return (
<main className="container mx-auto flex max-w-5xl flex-col items-center">
<CommentBoardHeader SEARCH_OPEN_KEY={SEARCH_OPEN_KEY} />

<section className="w-full py-4">
{/* todo skeleton */}
<Suspense key={JSON.stringify(query)}>
<CommentCardsList query={query} />
</Suspense>
</section>
</main>
);
}

0 comments on commit 02390fc

Please sign in to comment.