-
Notifications
You must be signed in to change notification settings - Fork 2
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
[FE] feat: 리뷰 그룹 목록 조회 API 연동 및 MSW 핸들러 수정 #1090
base: develop
Are you sure you want to change the base?
Changes from all commits
de753af
e1bb55c
374c27f
fdadd37
27aec28
7c780b7
237139b
a4ade66
720b134
99878dc
0d4eec6
b9978ac
ebf9de8
11178c5
3475641
d43e672
db631aa
aacd795
fe194ab
3d87270
149cccf
ee7061f
eb406d7
6146267
21c9d10
37533ad
7857738
32bee72
8e5b331
01f0f96
693a882
76fcf0d
3c73013
175c65e
40d0482
c31a51c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,33 @@ | ||
import useNavigationTabs from '@/hooks/useNavigationTabs'; | ||
import { useLocation } from 'react-router'; | ||
|
||
import NavItem from './NavItem'; | ||
import * as S from './styles'; | ||
export interface Tab { | ||
label: '리뷰 링크 관리' | '작성한 리뷰 확인'; | ||
activePathList: string[]; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 공통 컴포넌트라면 label에 올 수 있는 타입을 열어둬야 하지 않을까요?! |
||
handleTabClick: () => void; | ||
} | ||
|
||
const NavigationTab = () => { | ||
const { currentTabIndex, tabList } = useNavigationTabs(); | ||
interface NavigationTabProps { | ||
tabList: Tab[]; | ||
} | ||
|
||
const NavigationTab = ({ tabList }: NavigationTabProps) => { | ||
const { pathname } = useLocation(); | ||
|
||
const isActiveTab = (activePaths: string[]) => activePaths.some((activePath) => pathname.includes(activePath)); | ||
|
||
return ( | ||
<S.NavContainer> | ||
<S.NavList> | ||
{tabList.map((tab, index) => { | ||
return ( | ||
<NavItem | ||
key={tab.label} | ||
label={tab.label} | ||
$isSelected={currentTabIndex === index} | ||
onClick={tab.handleTabClick} | ||
/> | ||
); | ||
})} | ||
{tabList.map((tab) => ( | ||
<NavItem | ||
key={tab.label} | ||
label={tab.label} | ||
$isActiveTab={isActiveTab(tab.activePathList)} | ||
onClick={tab.handleTabClick} | ||
/> | ||
))} | ||
</S.NavList> | ||
</S.NavContainer> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
import { useLocation } from 'react-router'; | ||
|
||
import Breadcrumb from '@/components/common/Breadcrumb'; | ||
import NavigationTab from '@/components/common/NavigationTab'; | ||
import { ROUTE } from '@/constants'; | ||
import useBreadcrumbPaths from '@/hooks/useBreadcrumbPaths'; | ||
import useNavigationTabs from '@/hooks/useNavigationTabs'; | ||
import { EssentialPropsWithChildren } from '@/types'; | ||
|
||
import Footer from '../Footer'; | ||
|
@@ -11,16 +16,28 @@ import * as S from './styles'; | |
interface PageLayoutProps { | ||
isNeedBreadCrumb?: boolean; | ||
} | ||
|
||
const PageLayout = ({ children, isNeedBreadCrumb = true }: EssentialPropsWithChildren<PageLayoutProps>) => { | ||
// TODO: NavigationTab은 사용자가 홈 페이지와 연결 페이지가 아닌 다른 페이지에서 로그인 상태일 때만 보여준다. | ||
// 임시로 true 설정 (로그인 기능 추가하면서 여기도 수정해야 한다.) | ||
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 주석 좋아요~~ |
||
const isUserLoggedIn = true; | ||
|
||
const { pathname } = useLocation(); | ||
|
||
const breadcrumbPathList = useBreadcrumbPaths(); | ||
const isShowBreadCrumb = isNeedBreadCrumb && breadcrumbPathList.length > 1; | ||
const navigationTabList = useNavigationTabs(); | ||
const isShowBreadCrumb = !isUserLoggedIn && isNeedBreadCrumb && breadcrumbPathList.length > 1; | ||
const isShowNavigationTab = isUserLoggedIn && pathname !== '/' && !pathname.includes(ROUTE.reviewZone); | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 렌더링 로직 빡세네요...ㅋㅋㅋㅋㅋ 개발자살려~! |
||
|
||
return ( | ||
<S.Layout> | ||
<S.Wrapper> | ||
<Topbar /> | ||
{isShowNavigationTab && <NavigationTab tabList={navigationTabList} />} | ||
{isShowBreadCrumb && <Breadcrumb pathList={breadcrumbPathList} />} | ||
<Main isShowBreadCrumb={isShowBreadCrumb}>{children}</Main> | ||
<Main isShowBreadCrumb={isShowBreadCrumb} isShowNavigationTab={isShowNavigationTab}> | ||
{children} | ||
</Main> | ||
<Footer /> | ||
</S.Wrapper> | ||
</S.Layout> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,9 @@ export const REVIEW_MESSAGE = { | |
}; | ||
|
||
export const REVIEW_EMPTY = { | ||
noReviewInTotal: '아직 받은 리뷰가 없어요!', | ||
noReviewInQuestion: '이 질문은 아직 받은 답변이 없어요!', | ||
noReviewInTotal: '아직 받은 리뷰가 없어요...', | ||
noReviewLink: '생성한 리뷰 링크가 없어요...', | ||
noReviewInQuestion: '이 질문은 아직 받은 답변이 없어요...', | ||
}; | ||
Comment on lines
12
to
16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (원래 있었던 상수긴 하지만) 이 값들을 상수로 관리할 필요가 있을까요? 당장 수정하자는 건 아닙니다ㅎㅎ |
||
|
||
export const REVIEW_URL_GENERATOR_FORM_VALIDATION = { | ||
|
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.
gettingReviewLinks가 로그인한 사용자가 자신이 만든 리뷰 그룹 목록을 조회하는게 아닌가요?
![image](https://private-user-images.githubusercontent.com/69838872/412854826-b3d29016-6915-458d-bfab-3c06b693e78f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2ODY0NDksIm5iZiI6MTczOTY4NjE0OSwicGF0aCI6Ii82OTgzODg3Mi80MTI4NTQ4MjYtYjNkMjkwMTYtNjkxNS00NThkLWJmYWItM2MwNmI2OTNlNzhmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE2VDA2MDkwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE0Y2FjMmMzNTBiYzIzZGE3MDIyOGU0OGZmNDI0YTY5MzMyN2Y1YzU1ZDRhYWZiYmIyMGEwYzgwMTdmODI4ZmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.gRiRAId4-0yU8dzSIkRJF9_WaYwBHNxjefnr7ktfdjc)
자신이 만든 리뷰 그룹 목록을 조회하는거라면 다른 url로 요청을 보내야할 것 같은데요
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.
리뷰 그룹 생성, 리뷰 그룹 목록 조회 url이 같아서 저 상수를 사용했어요.
REVIEW_GROUP_DATA_API_URL
===https://api.review-me.page/v2/groups