-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/markup/my review/DEVING-70 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
32892cd
feat(DEVING-70): ๋ด๊ฐ ์์ฑํ ๋ฆฌ๋ทฐ API ์ฐ๋, ํญ ์ปดํฌ๋ํธ ์์
lee1nna 8895d53
feat(DEVING-70): ๋์ ๋ฆฌ๋ทฐ ๊ฒฝ๋ก ์ ๊ทผ ์ ๋ผ์ฐํฐ์ type ์ฟผ๋ฆฌ ์ธํ
๋ก์ง ์ถ๊ฐ
lee1nna 5c4932a
Merge branch 'dev' into feat/markup/my-review/DEVING-70
lee1nna 3dc8d46
feat(DEVING-78): ์์ฑํ ๋ฆฌ๋ทฐ ReviewItem ์ถ๊ฐ
lee1nna d058a01
Merge branch 'dev' into feat/markup/my-review/DEVING-70
lee1nna 1c0a032
feat(DEVING-78): ๋ด๊ฐ ์์ฑํ ๋ฆฌ๋ทฐ ๋ฌดํ์คํฌ๋กค observer ์ถ๊ฐ
lee1nna 5595912
feat(DEVING-70): ๋ชจ์ ์กฐํ ํํฐ๋ง NEW -> CREATED๋ก ๋ณ๊ฒฝ
lee1nna 71baaf5
Merge branch 'dev' into feat/markup/my-review/DEVING-70
lee1nna 31ecd31
feat(DEVING-70): ๋ฆฌ๋ทฐ ์์ฑ ๊ฐ๋ฅํ ๋ชจ์ API ์ฐ๋
lee1nna c32bddd
Merge branch 'dev' into feat/markup/my-review/DEVING-70
lee1nna 90b95d9
feat(DEVING-70): ๋์ ๋ฆฌ๋ทฐ ์นด๋ ์ปดํฌ๋ํธ์ ์ข์์ ๋ฒํผ ์ ๊ฑฐ
lee1nna 0ac2902
Merge branch 'dev' into feat/markup/my-review/DEVING-70
lee1nna 7bd40dc
feat(DEVING-70): ๋ฆฌ๋ทฐ ์์ ๊ฒฝ์ฐ UI ์ถ๊ฐ
lee1nna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,133 @@ | ||
| 'use client'; | ||
|
|
||
| import HorizonCard from '@/components/ui/HorizonCard'; | ||
| import useInfiniteScroll from '@/hooks/common/useInfiniteScroll'; | ||
| import { useInfiniteWritableMyMeetingsQueries } from '@/hooks/queries/useMyCommentQueries'; | ||
| import { translateCategoryNameToEng } from '@/util/searchFilter'; | ||
| import { useRouter } from 'next/navigation'; | ||
| import { MyComment } from 'types/myComment'; | ||
|
|
||
| import MeetingListSkeleton from './skeletons/SkeletonMeetingList'; | ||
|
|
||
| const Writable = () => { | ||
| const router = useRouter(); | ||
| const { | ||
| data: meetingData, | ||
| fetchNextPage, | ||
| hasNextPage, | ||
| isFetchingNextPage, | ||
| isLoading, | ||
| error, | ||
| } = useInfiniteWritableMyMeetingsQueries(); | ||
|
|
||
| const allMeetings: MyComment[] = | ||
| meetingData?.pages.flatMap((page) => page.content) || []; | ||
|
|
||
| const lastMeetingRef = useInfiniteScroll({ | ||
| fetchNextPage, | ||
| isFetchingNextPage, | ||
| hasNextPage, | ||
| }); | ||
|
|
||
| if (error) { | ||
| <div className="bg-main text-white"> | ||
| ์๋ฌ๊ฐ ๋ฐ์ํ์ต๋๋ค. <hr /> | ||
| ๋ค์ ์๋ํด์ฃผ์ธ์. | ||
| </div>; | ||
| } | ||
|
|
||
| if (isLoading) { | ||
| return <MeetingListSkeleton />; | ||
| } | ||
|
|
||
| const handleMoveDetailPage = (meetingId: number, category: string) => { | ||
| const categoryEng = translateCategoryNameToEng(category); | ||
| router.push(`/meeting/${categoryEng}/${meetingId}`); | ||
| }; | ||
|
|
||
| return ( | ||
| <div> | ||
| {allMeetings.length === 0 && ( | ||
| <div className="text-gray-500 py-8 text-center text-white"> | ||
| ๋ฆฌ๋ทฐ ์์ฑ ๊ฐ๋ฅํ ๋ชจ์์ด ์์ต๋๋ค. <br /> | ||
| ๋ชจ์์ ์ฐธ์ฌํ๊ณ ๋ฆฌ๋ทฐ๋ฅผ ์์ฑํด๋ณด์ธ์! | ||
| </div> | ||
| )} | ||
| <div> | ||
| {allMeetings.map((meeting) => ( | ||
| <div key={meeting.meetingId}> | ||
| {/* ๋ฐ์คํฌํ */} | ||
| <div className="hidden border-b border-Cgray300 py-[42px] lg:flex"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(meeting.meetingId, meeting.categoryTitle) | ||
| } | ||
| key={meeting.meetingId} | ||
| title={meeting.meetingTitle} | ||
| thumbnailUrl={meeting.thumbnail} | ||
| location={meeting.location} | ||
| total={meeting.maxMember} | ||
| value={meeting.memberCount} | ||
| className="flex-row" | ||
| showLikeButton={false} | ||
| meetingId={meeting.meetingId} | ||
| category={''} | ||
| ></HorizonCard> | ||
| </div> | ||
|
|
||
| {/* ํ๋ธ๋ฆฟ */} | ||
| <div className="hidden flex-col border-b border-Cgray300 py-[42px] md:flex lg:hidden"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(meeting.meetingId, meeting.categoryTitle) | ||
| } | ||
| key={meeting.meetingId} | ||
| title={meeting.meetingTitle} | ||
| thumbnailUrl={meeting.thumbnail} | ||
| location={meeting.location} | ||
| total={meeting.maxMember} | ||
| value={meeting.memberCount} | ||
| thumbnailHeight={160} | ||
| thumbnailWidth={160} | ||
| meetingId={meeting.meetingId} | ||
| category={''} | ||
| showLikeButton={false} | ||
| /> | ||
| </div> | ||
|
|
||
| {/* ๋ชจ๋ฐ์ผ */} | ||
| <div className="flex flex-col border-b border-Cgray300 py-[42px] md:hidden"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(meeting.meetingId, meeting.categoryTitle) | ||
| } | ||
| key={meeting.meetingId} | ||
| title={meeting.meetingTitle} | ||
| thumbnailUrl={meeting.thumbnail} | ||
| location={meeting.location} | ||
| total={meeting.maxMember} | ||
| value={meeting.memberCount} | ||
| thumbnailHeight={80} | ||
| thumbnailWidth={80} | ||
| meetingId={meeting.meetingId} | ||
| category={''} | ||
| showLikeButton={false} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ))} | ||
|
|
||
| {/* ๋ฌดํ ์คํฌ๋กค์ ์ํ ๋ณ๋์ Observer ์์ */} | ||
| {hasNextPage && ( | ||
| <div | ||
| ref={lastMeetingRef} | ||
| className="h-20 w-full" | ||
| id="infinite-scroll-trigger" | ||
| /> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
|
|
||
| export default Writable; |
This file contains hidden or 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,151 @@ | ||
| 'use client'; | ||
|
|
||
| import ReviewItem from '@/app/meeting/_features/ReviewItem'; | ||
| import HorizonCard from '@/components/ui/HorizonCard'; | ||
| import useInfiniteScroll from '@/hooks/common/useInfiniteScroll'; | ||
| import { useInfiniteWrittenMyCommentQueries } from '@/hooks/queries/useMyCommentQueries'; | ||
| import { translateCategoryNameToEng } from '@/util/searchFilter'; | ||
| import { useRouter } from 'next/navigation'; | ||
| import { MyComment } from 'types/myComment'; | ||
|
|
||
| import MeetingListSkeleton from './skeletons/SkeletonMeetingList'; | ||
|
|
||
| const Written = () => { | ||
| const router = useRouter(); | ||
| const { | ||
| data: commentData, | ||
| fetchNextPage, | ||
| hasNextPage, | ||
| isFetchingNextPage, | ||
| isLoading, | ||
| error, | ||
| } = useInfiniteWrittenMyCommentQueries(); | ||
|
|
||
| const allComments: MyComment[] = | ||
| commentData?.pages.flatMap((page) => page.content) || []; | ||
|
|
||
| const lastMeetingRef = useInfiniteScroll({ | ||
| fetchNextPage, | ||
| isFetchingNextPage, | ||
| hasNextPage, | ||
| }); | ||
|
|
||
| if (error) { | ||
| <div className="bg-main text-white"> | ||
| ์๋ฌ๊ฐ ๋ฐ์ํ์ต๋๋ค. <hr /> | ||
| ๋ค์ ์๋ํด์ฃผ์ธ์. | ||
| </div>; | ||
| } | ||
|
|
||
| if (isLoading) { | ||
| return <MeetingListSkeleton />; | ||
| } | ||
|
|
||
| const handleMoveDetailPage = (meetingId: number, category: string) => { | ||
| const categoryEng = translateCategoryNameToEng(category); | ||
| router.push(`/meeting/${categoryEng}/${meetingId}`); | ||
| }; | ||
|
|
||
| return ( | ||
| <div> | ||
| {/* ๋ฐ์ดํฐ๊ฐ ์๋ ๊ฒฝ์ฐ ํ์ */} | ||
| {allComments.length === 0 && ( | ||
| <div className="text-gray-500 py-8 text-center text-white"> | ||
| ์์ฑํ ๋ฆฌ๋ทฐ๊ฐ ์์ต๋๋ค. <br /> | ||
| ๋ชจ์์ ์ฐธ์ฌํ๊ณ ๋ฆฌ๋ทฐ๋ฅผ ์์ฑํด๋ณด์ธ์! | ||
| </div> | ||
| )} | ||
| <div> | ||
| {allComments.map((comment) => ( | ||
| <div key={comment.meetingId}> | ||
| {/* ๋ฐ์คํฌํ */} | ||
| <div className="hidden border-b border-Cgray300 py-[42px] lg:flex"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(comment.meetingId, comment.categoryTitle) | ||
| } | ||
| key={comment.meetingId} | ||
| title={comment.meetingTitle} | ||
| thumbnailUrl={comment.thumbnail} | ||
| location={comment.location} | ||
| total={comment.maxMember} | ||
| value={comment.memberCount} | ||
| className="flex-row p-0" | ||
| meetingId={comment.meetingId} | ||
| showLikeButton={false} | ||
| category={''} | ||
| ></HorizonCard> | ||
| <ReviewItem | ||
| comment={comment} | ||
| isMine={true} | ||
| className="px-6" | ||
| ></ReviewItem> | ||
| </div> | ||
|
|
||
| {/* ํ๋ธ๋ฆฟ */} | ||
| <div className="hidden flex-col border-b border-Cgray300 py-[42px] md:flex lg:hidden"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(comment.meetingId, comment.categoryTitle) | ||
| } | ||
| key={comment.meetingId} | ||
| title={comment.meetingTitle} | ||
| thumbnailUrl={comment.thumbnail} | ||
| location={comment.location} | ||
| total={comment.maxMember} | ||
| value={comment.memberCount} | ||
| thumbnailHeight={160} | ||
| thumbnailWidth={160} | ||
| className="p-0" | ||
| meetingId={comment.meetingId} | ||
| showLikeButton={false} | ||
| category={''} | ||
| /> | ||
| <ReviewItem | ||
| comment={comment} | ||
| isMine={true} | ||
| className="px-6" | ||
| ></ReviewItem> | ||
| </div> | ||
|
|
||
| {/* ๋ชจ๋ฐ์ผ */} | ||
| <div className="flex flex-col border-b border-Cgray300 py-[42px] md:hidden"> | ||
| <HorizonCard | ||
| onClick={() => | ||
| handleMoveDetailPage(comment.meetingId, comment.categoryTitle) | ||
| } | ||
| key={comment.meetingId} | ||
| title={comment.meetingTitle} | ||
| thumbnailUrl={comment.thumbnail} | ||
| location={comment.location} | ||
| total={comment.maxMember} | ||
| value={comment.memberCount} | ||
| thumbnailHeight={80} | ||
| thumbnailWidth={80} | ||
| className="" | ||
| meetingId={comment.meetingId} | ||
| category={''} | ||
| showLikeButton={false} | ||
| /> | ||
| <ReviewItem | ||
| comment={comment} | ||
| isMine={true} | ||
| className="px-6" | ||
| ></ReviewItem> | ||
| </div> | ||
| </div> | ||
| ))} | ||
|
|
||
| {/* ๋ฌดํ ์คํฌ๋กค์ ์ํ ๋ณ๋์ Observer ์์ */} | ||
| {hasNextPage && ( | ||
| <div | ||
| ref={lastMeetingRef} | ||
| className="h-20 w-full" | ||
| id="infinite-scroll-trigger" | ||
| /> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| }; | ||
| export default Written; |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,5 +1,61 @@ | ||
| import NotYet from '@/components/common/NotYet'; | ||
| import { MY_COMMENT_KEY } from '@/hooks/queries/useMyCommentQueries'; | ||
| import { | ||
| HydrationBoundary, | ||
| QueryClient, | ||
| dehydrate, | ||
| } from '@tanstack/react-query'; | ||
| import { MY_COMMENT_TAB_LIST } from 'constants/mypage/mypageConstant'; | ||
| import { | ||
| getMyMeetingsWritableComments, | ||
| getMyWrittenComments, | ||
| } from 'service/api/mycomments'; | ||
| import { Paginated } from 'types/meeting'; | ||
| import { MyComment } from 'types/myComment'; | ||
|
|
||
| export default function CommentsPage() { | ||
| return <NotYet />; | ||
| import Tab from '../_features/Tab'; | ||
| import Writable from '../_features/Writable'; | ||
| import Written from '../_features/Written'; | ||
|
|
||
| export default async function CommentsPage({ | ||
| searchParams, | ||
| }: { | ||
| searchParams: { type: string }; | ||
| }) { | ||
| const type = searchParams?.type; | ||
|
|
||
| const queryClient = new QueryClient(); | ||
|
|
||
| if (type === 'writable') { | ||
| // ์์ฑ ๊ฐ๋ฅํ ๋ฆฌ๋ทฐ prefetch | ||
| await queryClient.prefetchInfiniteQuery({ | ||
| queryKey: MY_COMMENT_KEY.written, | ||
| queryFn: ({ pageParam }) => getMyMeetingsWritableComments(pageParam), | ||
| initialPageParam: 0, | ||
| getNextPageParam: (lastPage: Paginated<MyComment>) => { | ||
| return lastPage.nextCursor ?? null; | ||
| }, | ||
| }); | ||
| } else { | ||
| // ์์ฑํ ๋ฆฌ๋ทฐ prefetch | ||
| await queryClient.prefetchInfiniteQuery({ | ||
| queryKey: MY_COMMENT_KEY.written, | ||
| queryFn: ({ pageParam }) => getMyWrittenComments(pageParam), | ||
| initialPageParam: 0, | ||
| getNextPageParam: (lastPage: Paginated<MyComment>) => { | ||
| return lastPage.nextCursor ?? null; | ||
| }, | ||
| }); | ||
| } | ||
|
|
||
| return ( | ||
| <div> | ||
| <div className="mt-6 flex flex-col gap-[24px]"> | ||
| <Tab type={type} tabList={MY_COMMENT_TAB_LIST} /> | ||
| </div> | ||
| <HydrationBoundary state={dehydrate(queryClient)}> | ||
| {type === 'writable' ? <Writable /> : <Written />} | ||
| </HydrationBoundary> | ||
| </div> | ||
| ); | ||
| } | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
์๊ณ ๋ ์ง์ฐ์ ๋ ๋ ๊ฒ๊ฐ์ด๋๋น
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
๋ต ๋ค๋ฅธ ๋ธ๋์น์์ ๋ฐ์ํ๊ฒ ์ต๋๋น!