Skip to content

Commit 36a9f0e

Browse files
authored
Merge pull request #4163 from Northeastern-Electric-Racing/limit-tabs-on-guest-project-page-#4089
#4089 Limit tabs shown on projects page for guests
2 parents ab55cdd + 584d8d6 commit 36a9f0e

1 file changed

Lines changed: 35 additions & 2 deletions

File tree

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

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import { Link, useHistory } from 'react-router-dom';
7-
import { Project, isGuest, isAdmin, isLeadership, RoleEnum } from 'shared';
7+
import { Project, isGuest, isAdmin, isLeadership } from 'shared';
88
import { projectWbsPipe, wbsPipe } from '../../../utils/pipes';
99
import ProjectDetails from './ProjectDetails';
1010
import { routes } from '../../../utils/routes';
@@ -179,6 +179,39 @@ const ProjectViewContainer: React.FC<ProjectViewContainerProps> = ({ project, en
179179

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

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

0 commit comments

Comments
 (0)