diff --git a/src/app/(crew)/my-page/_components/review-section.tsx b/src/app/(crew)/my-page/_components/review-section.tsx deleted file mode 100644 index b9365ba0..00000000 --- a/src/app/(crew)/my-page/_components/review-section.tsx +++ /dev/null @@ -1,81 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import { Divider } from '@mantine/core'; -import { useInfiniteScroll } from '@/src/hooks/use-infinite-scroll'; -import { fetchWritableGatheringData } from '@/src/app/(crew)/api/mock-api/writable-gathering'; -import { fetchMyReviewData } from '@/src/app/api/mock-api/review'; -import ReviewCardList from '@/src/components/common/review-list/review-card-list'; -import Tabs from '@/src/components/common/tab'; -import WritableGatheringCardList from '@/src/components/common/writable-gathering-card/writable-gathering-card-list'; -import { ReviewInformResponse } from '@/src/types/review'; -import { WritableGatheringCardInformResponse } from '@/src/types/writable-gathering-card'; - -export default function ReviewSection() { - const myPageTabs = [ - { label: '작성 가능한 리뷰', id: 'available-review' }, - { label: '작성한 리뷰', id: 'my-review' }, - ]; - const [currentTab, setCurrentTab] = useState(myPageTabs[0].id); - - const { - data: reviewData, - ref: reviewRef, - isFetchingNextPage: isFetchingReviewNextPage, - } = useInfiniteScroll({ - queryKey: ['review'], - queryFn: ({ pageParam = 0 }) => fetchMyReviewData(pageParam, 3), - getNextPageParam: (lastPage, allPages) => - lastPage.hasNextPage ? allPages.length + 1 : undefined, - }); - - const { - data: gatheringData, - ref: gatheringRef, - isFetchingNextPage: isFetchingGatheringNextPage, - } = useInfiniteScroll({ - queryKey: ['crew'], - queryFn: ({ pageParam = 0 }) => fetchWritableGatheringData(pageParam, 3), - getNextPageParam: (lastPage, allPages) => - lastPage.hasNextPage ? allPages.length + 1 : undefined, - }); - - const renderTabContent = () => { - switch (currentTab) { - case 'my-review': - return ( - - ); - default: - return ( - - ); - } - }; - - return ( -
-

나의 리뷰 모아보기

- -
- setCurrentTab(id)} - /> -
-
{renderTabContent()}
-
- ); -} diff --git a/src/app/(crew)/my-page/_components/review-tabs.tsx b/src/app/(crew)/my-page/_components/review-tabs.tsx new file mode 100644 index 00000000..0fcbb3f8 --- /dev/null +++ b/src/app/(crew)/my-page/_components/review-tabs.tsx @@ -0,0 +1,63 @@ +'use client'; + +import { useState } from 'react'; +import { useRouter } from 'next/navigation'; +import { Divider } from '@mantine/core'; +import Tabs from '@/src/components/common/tab'; + +export default function ReviewTabs() { + const myPageTabs = [ + { label: '작성 가능한 리뷰', id: 'available-review', route: '/my-page/reviewable' }, + { label: '작성한 리뷰', id: 'my-review', route: '/my-page/my-review' }, + ]; + const [currentTab, setCurrentTab] = useState(myPageTabs[0].id); + const router = useRouter(); + const handleTabClick = (id: string) => { + setCurrentTab(id); + + const selectedTab = myPageTabs.find((tab) => tab.id === id); + if (selectedTab?.route) { + try { + router.push(selectedTab.route); + } catch (error) { + throw error; + } + } + }; + + /* const { + data: reviewData, + ref: reviewRef, + isFetchingNextPage: isFetchingReviewNextPage, + } = useInfiniteScroll({ + queryKey: ['review'], + queryFn: ({ pageParam = 0 }) => fetchMyReviewData(pageParam, 3), + getNextPageParam: (lastPage, allPages) => + lastPage.hasNextPage ? allPages.length + 1 : undefined, + }); + + const { + data: gatheringData, + ref: gatheringRef, + isFetchingNextPage: isFetchingGatheringNextPage, + } = useInfiniteScroll({ + queryKey: ['crew'], + queryFn: ({ pageParam = 0 }) => getReviewableGatherings(pageParam), + getNextPageParam: (lastPage, allPages) => (lastPage.hasNext ? allPages.length + 1 : undefined), + }); +*/ + return ( +
+

나의 리뷰 모아보기

+ +
+ +
+
+ ); +} diff --git a/src/app/(crew)/my-page/layout.tsx b/src/app/(crew)/my-page/layout.tsx new file mode 100644 index 00000000..6cd148f5 --- /dev/null +++ b/src/app/(crew)/my-page/layout.tsx @@ -0,0 +1,14 @@ +import ProfileCardContainer from '@/src/app/(crew)/my-page/_components/profile-card/container'; +import ReviewTabs from './_components/review-tabs'; + +export default function MyPage() { + return ( +
+
+ +
+ +
+
+ ); +} diff --git a/src/app/(crew)/my-page/my-review/page.tsx b/src/app/(crew)/my-page/my-review/page.tsx new file mode 100644 index 00000000..19b61e14 --- /dev/null +++ b/src/app/(crew)/my-page/my-review/page.tsx @@ -0,0 +1,3 @@ +export default function MyReviewPage() { + return
my review list component
; +} diff --git a/src/app/(crew)/my-page/page.tsx b/src/app/(crew)/my-page/page.tsx index aec59289..57e2baa1 100644 --- a/src/app/(crew)/my-page/page.tsx +++ b/src/app/(crew)/my-page/page.tsx @@ -1,14 +1,7 @@ -import ProfileCardContainer from '@/src/app/(crew)/my-page/_components/profile-card/container'; -import ReviewSection from '@/src/app/(crew)/my-page/_components/review-section'; +'use client'; + +import { redirect } from 'next/navigation'; export default function MyPage() { - return ( -
-
- -
- -
-
- ); + redirect('/my-page/reviewable'); } diff --git a/src/app/(crew)/my-page/reviewable/page.tsx b/src/app/(crew)/my-page/reviewable/page.tsx new file mode 100644 index 00000000..46859f91 --- /dev/null +++ b/src/app/(crew)/my-page/reviewable/page.tsx @@ -0,0 +1,3 @@ +export default function ReviewableGatheringsPage() { + return
reviewable gathering list component
; +}