-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close #167 * ♻️ Refactor(create-board): error-boundary 로직 수정 related to: #169 * ♻️ Refactor: 페이지네이션 버튼 공통 컴포넌트로 분리 * 🚚 Rename: table content 컴포넌트 위치 이동 * 🚚 Rename(board): 활동 게시판 페이지 구조 수정 related to: #167 * ✨ Feat(board): 활동 게시글 불러오기 추가 related to: #167 * ♻️ Refactor: post table 공통 컴포넌트로 분리 * 💄 Design(board): 활동 게시글 테이블 UI 추가 related to: #167
- Loading branch information
Showing
20 changed files
with
212 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 0 additions & 68 deletions
68
...vity/[semesterName]/[activityId]/_components/BoardSection/BoardPaginationButton/index.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ty/[semesterName]/[activityId]/boards/[boardId]/_components/ActivityPostSection/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useEffect } from 'react' | ||
|
||
import { useSearchParams } from 'next/navigation' | ||
|
||
import { PaginationButtons } from '@/components/PaginationButtons' | ||
import { PostTable } from '@/components/Table/PostTable' | ||
import { queryClient } from '@/service/components/ReactQueryClientProvider' | ||
import { useGetActivityPostsPaging } from '@/service/data/post' | ||
import { getActivityPostsPaging } from '@/service/server/post' | ||
|
||
type ActivityPostSectionProps = { | ||
boardId: number | ||
} | ||
|
||
export const ActivityPostSection = ({ boardId }: ActivityPostSectionProps) => { | ||
const searchParams = useSearchParams() | ||
const params = new URLSearchParams(searchParams) | ||
|
||
const page = | ||
Number(params.get('page')) > 0 ? Number(params.get('page')) - 1 : 0 | ||
|
||
const { data, status, isPlaceholderData } = useGetActivityPostsPaging({ | ||
boardId, | ||
page, | ||
}) | ||
|
||
useEffect(() => { | ||
if (!isPlaceholderData && data?.nextPageToken) { | ||
queryClient.prefetchQuery({ | ||
queryKey: ['posts', boardId, page], | ||
queryFn: () => getActivityPostsPaging({ boardId, page }), | ||
}) | ||
} | ||
}, [data, isPlaceholderData, page, queryClient]) | ||
|
||
if (status === 'pending') | ||
return <div className="flex w-full justify-center">loading...</div> | ||
|
||
if (!data) { | ||
return <div>게시글이 없습니다.</div> | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col gap-6"> | ||
<PostTable | ||
posts={data.posts} | ||
pageNumber={page} | ||
pageSize={data.pageInfo.pageSize} | ||
/> | ||
<PaginationButtons data={data} /> | ||
</div> | ||
) | ||
} |
28 changes: 0 additions & 28 deletions
28
.../activity/[semesterName]/[activityId]/boards/[boardId]/_components/BoardContent/index.tsx
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.