Skip to content

Commit 8aed2d1

Browse files
committed
#4089 Limit tabs shown on projects page for guests
1 parent 45a3609 commit 8aed2d1

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ProjectViewContainer.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,39 @@ const ProjectViewContainer: React.FC<ProjectViewContainerProps> = ({ project, en
179179

180180
const wbsNum = wbsPipe(project.wbsNum);
181181

182+
if (user.role === RoleEnum.GUEST) return (
183+
<PageLayout
184+
title={pageTitle}
185+
headerRight={headerRight}
186+
tabs={
187+
<FullPageTabs
188+
setTab={setTab}
189+
tabsLabels={[
190+
{ tabUrlValue: 'overview', tabName: 'Overview' },
191+
{ tabUrlValue: 'tasks', tabName: 'Tasks' },
192+
{ tabUrlValue: 'changes', tabName: 'Changes' },
193+
{ tabUrlValue: 'gantt', tabName: 'Gantt' }
194+
]}
195+
baseUrl={`${routes.PROJECTS}/${wbsNum}`}
196+
defaultTab='overview'
197+
id='project-detail-tabs'
198+
/>
199+
}
200+
previousPages={[{ name: 'Projects', route: routes.PROJECTS }]}
201+
>
202+
{tab === 0 ? (
203+
<ProjectDetails project={project} />
204+
) : tab === 1 ? (
205+
<TaskList project={project} isGuest={user.role === RoleEnum.GUEST} />
206+
) : tab === 2 ? (
207+
<ChangesList changes={project.changes} />
208+
) : (
209+
<ProjectGantt workPackages={project.workPackages} />
210+
)
211+
}
212+
</PageLayout>
213+
)
214+
182215
return (
183216
<PageLayout
184217
title={pageTitle}

0 commit comments

Comments
 (0)