-
Notifications
You must be signed in to change notification settings - Fork 3
♻️ Refactor: my-review의 탭 동작 수정 #144
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
2 commits
Select commit
Hold shift + click to select a range
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 was deleted.
Oops, something went wrong.
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,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<ReviewInformResponse>({ | ||
| 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<ReviewableGatheringCardInformResponse>({ | ||
| queryKey: ['crew'], | ||
| queryFn: ({ pageParam = 0 }) => getReviewableGatherings(pageParam), | ||
| getNextPageParam: (lastPage, allPages) => (lastPage.hasNext ? allPages.length + 1 : undefined), | ||
| }); | ||
| */ | ||
| return ( | ||
| <div className="mt-12 flex flex-col"> | ||
| <h3 className="text-2xl font-semibold text-gray-900">나의 리뷰 모아보기</h3> | ||
| <Divider mt={16} mb={24} size={2} /> | ||
| <div className="flex justify-start"> | ||
| <Tabs | ||
| variant="review" | ||
| tabs={myPageTabs} | ||
| activeTab={currentTab} | ||
| onTabClick={handleTabClick} | ||
| /> | ||
| </div> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ( | ||
| <div className="container mx-auto my-0 min-h-screen max-w-pc bg-gray-50 px-3 py-11 md:px-8 lg:px-11"> | ||
| <div className="lg:gap-4.5 flex flex-col gap-3 md:gap-4"> | ||
| <ProfileCardContainer /> | ||
| </div> | ||
| <ReviewTabs /> | ||
| <div /> | ||
| </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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export default function MyReviewPage() { | ||
| return <div>my review list component</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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ( | ||
| <div className="container mx-auto my-0 min-h-screen max-w-pc bg-gray-50 px-3 py-11 md:px-8 lg:px-11"> | ||
| <div className="lg:gap-4.5 flex flex-col gap-3 md:gap-4"> | ||
| <ProfileCardContainer /> | ||
| </div> | ||
| <ReviewSection /> | ||
| <div /> | ||
| </div> | ||
| ); | ||
| redirect('/my-page/reviewable'); | ||
| } |
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,3 @@ | ||
| export default function ReviewableGatheringsPage() { | ||
| return <div>reviewable gathering list component</div>; | ||
| } |
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.
🛠️ Refactor suggestion
접근성 개선을 위한 aria 속성 추가가 필요합니다.
스크린 리더 사용자를 위해 탭 컴포넌트에 적절한 aria 레이블을 추가하면 좋겠습니다.
📝 Committable suggestion