Refactor: 헤더에서 페이지 이동 시 현재 프로젝트 유지하면서 이동하도록 처리
This commit is contained in:
parent
df6b87d8f7
commit
e8dc0c8d7e
@ -19,6 +19,7 @@ export default function WorkspaceNavigation() {
|
||||
const workspaces = workspacesResponse?.workspaceResponses || [];
|
||||
|
||||
const activeWorkspaceId = workspaceId ?? workspaces[0]?.id;
|
||||
const activeProjectId: number = Number(location.pathname.split('/')[3] || '0');
|
||||
|
||||
if (workspaces.length === 0) {
|
||||
return <div></div>;
|
||||
@ -35,25 +36,35 @@ export default function WorkspaceNavigation() {
|
||||
{activeWorkspaceId && (
|
||||
<>
|
||||
<Link
|
||||
to={`/workspace/${activeWorkspaceId}`}
|
||||
to={
|
||||
activeProjectId === 0
|
||||
? `/workspace/${activeWorkspaceId}`
|
||||
: `/workspace/${activeWorkspaceId}/${activeProjectId}`
|
||||
}
|
||||
className={isWorkspacePage ? 'body-strong' : 'body'}
|
||||
>
|
||||
labeling
|
||||
</Link>
|
||||
<Link
|
||||
to={`/review/${activeWorkspaceId}`}
|
||||
to={
|
||||
activeProjectId === 0 ? `/review/${activeWorkspaceId}` : `/review/${activeWorkspaceId}/${activeProjectId}`
|
||||
}
|
||||
className={isReviewPage ? 'body-strong' : 'body'}
|
||||
>
|
||||
review
|
||||
</Link>
|
||||
<Link
|
||||
to={`/model/${activeWorkspaceId}`}
|
||||
to={
|
||||
activeProjectId === 0 ? `/model/${activeWorkspaceId}` : `/model/${activeWorkspaceId}/${activeProjectId}`
|
||||
}
|
||||
className={isModelPage ? 'body-strong' : 'body'}
|
||||
>
|
||||
model
|
||||
</Link>
|
||||
<Link
|
||||
to={`/member/${activeWorkspaceId}`}
|
||||
to={
|
||||
activeProjectId === 0 ? `/member/${activeWorkspaceId}` : `/member/${activeWorkspaceId}/${activeProjectId}`
|
||||
}
|
||||
className={isMemberPage ? 'body-strong' : 'body'}
|
||||
>
|
||||
member
|
||||
|
Loading…
Reference in New Issue
Block a user