Skip to content

Commit 7d96886

Browse files
abstract + fix
1 parent 473bf81 commit 7d96886

4 files changed

Lines changed: 93 additions & 140 deletions

File tree

src/backend/src/transformers/teams.transformer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Team, TeamPreview, TeamBase } from 'shared';
33
import { getTeamBaseQueryArgs, TeamPreviewQueryArgs, TeamQueryArgs } from '../prisma-query-args/teams.query-args.js';
44
import { userTransformer } from './user.transformer.js';
55
import { projectGanttTransformer } from './projects.transformer.js';
6+
import { teamTypeTransformer } from './team-types.transformer.js';
67

78
const teamTransformer = (team: Prisma.TeamGetPayload<TeamQueryArgs>): Team => {
89
return {

src/frontend/src/app/AppAuthenticated.tsx

Lines changed: 22 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -21,90 +21,23 @@ import LoadingIndicator from '../components/LoadingIndicator';
2121
import SessionTimeoutAlert from './SessionTimeoutAlert';
2222
import SetUserPreferences from '../pages/HomePage/components/SetUserPreferences';
2323
import Finance from '../pages/FinancePage/Finance';
24-
import Sidebar from '../layouts/Sidebar/Sidebar';
25-
import { Box } from '@mui/system';
26-
import { Container, IconButton, useTheme } from '@mui/material';
2724
import ErrorPage from '../pages/ErrorPage';
2825
import { Role, isGuest } from 'shared';
29-
import { useState } from 'react';
30-
import ArrowCircleRightTwoToneIcon from '@mui/icons-material/ArrowCircleRightTwoTone';
31-
import HiddenContentMargin from '../components/HiddenContentMargin';
32-
import { useHomePageContext } from './HomePageContext';
3326
import { useCurrentOrganization } from '../hooks/organizations.hooks';
3427
import Statistics from '../pages/StatisticsPage/Statistics';
3528
import RetrospectiveGanttChartPage from '../pages/RetrospectivePage/Retrospective';
3629
import Calendar from '../pages/CalendarPage/Calendar';
3730
import GuestEventPage from '../pages/GuestEventPage/GuestEventPage';
31+
import SidebarLayout from '../layouts/SidebarLayout';
3832

3933
interface AppAuthenticatedProps {
4034
userId: string;
4135
userRole: Role;
4236
}
4337

44-
const SidebarLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
45-
const theme = useTheme();
46-
const [drawerOpen, setDrawerOpen] = useState(false);
47-
const [moveContent, setMoveContent] = useState(false);
48-
const { onGuestHomePage } = useHomePageContext();
49-
50-
return (
51-
<>
52-
<Box
53-
onMouseEnter={() => {
54-
setDrawerOpen(true);
55-
}}
56-
sx={{
57-
height: '100vh',
58-
position: 'fixed',
59-
width: 15,
60-
borderRight: 2,
61-
borderRightColor: theme.palette.background.paper
62-
}}
63-
/>
64-
<IconButton
65-
onClick={() => {
66-
setDrawerOpen(true);
67-
setMoveContent(true);
68-
}}
69-
sx={{ position: 'fixed', left: -8, top: '3%' }}
70-
id="sidebar-button"
71-
>
72-
<ArrowCircleRightTwoToneIcon
73-
sx={{
74-
fontSize: '30px',
75-
zIndex: 1,
76-
'& path:first-of-type': { color: '#000000' },
77-
'& path:last-of-type': { color: '#ef4345' }
78-
}}
79-
/>
80-
</IconButton>
81-
<Sidebar
82-
drawerOpen={drawerOpen}
83-
setDrawerOpen={setDrawerOpen}
84-
moveContent={moveContent}
85-
setMoveContent={setMoveContent}
86-
/>
87-
<Box display={'flex'}>
88-
<HiddenContentMargin open={moveContent} variant="permanent" />
89-
<Container
90-
maxWidth={false}
91-
sx={{ width: onGuestHomePage && moveContent ? 'calc(100vw - 220px)' : `calc(100vw - 30px)` }}
92-
>
93-
{children}
94-
</Container>
95-
</Box>
96-
</>
97-
);
98-
};
99-
10038
const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole }) => {
10139
const { isLoading, isError, error, data: userSettingsData } = useSingleUserSettings(userId);
10240

103-
const theme = useTheme();
104-
const [drawerOpen, setDrawerOpen] = useState(false);
105-
const [moveContent, setMoveContent] = useState(false);
106-
const { onGuestHomePage } = useHomePageContext();
107-
10841
const {
10942
data: organization,
11043
isLoading: organizationIsLoading,
@@ -127,72 +60,27 @@ const AppAuthenticated: React.FC<AppAuthenticatedProps> = ({ userId, userRole })
12760

12861
return userSettingsData.slackId || isGuest(userRole) ? (
12962
<AppContextUser>
130-
{
131-
<>
132-
<Box
133-
onMouseEnter={() => {
134-
setDrawerOpen(true);
135-
}}
136-
sx={{
137-
height: '100vh',
138-
position: 'fixed',
139-
width: 15,
140-
borderRight: 2,
141-
borderRightColor: theme.palette.background.paper
142-
}}
143-
/>
144-
<IconButton
145-
onClick={() => {
146-
setDrawerOpen(true);
147-
setMoveContent(true);
148-
}}
149-
sx={{ position: 'fixed', left: -8, top: '3%' }}
150-
id="sidebar-button"
151-
>
152-
<ArrowCircleRightTwoToneIcon
153-
sx={{
154-
fontSize: '30px',
155-
zIndex: 1,
156-
'& path:first-of-type': { color: '#000000' },
157-
'& path:last-of-type': { color: '#ef4345' }
158-
}}
159-
/>
160-
</IconButton>
161-
<Sidebar
162-
drawerOpen={drawerOpen}
163-
setDrawerOpen={setDrawerOpen}
164-
moveContent={moveContent}
165-
setMoveContent={setMoveContent}
166-
/>
167-
</>
168-
}
169-
<Box display={'flex'}>
170-
<HiddenContentMargin open={moveContent} variant="permanent" />
171-
<Container
172-
maxWidth={false}
173-
sx={{ width: onGuestHomePage && moveContent ? 'calc(100vw - 220px)' : `calc(100vw - 30px)` }}
174-
>
175-
<Switch>
176-
<Route path={routes.PROJECTS} component={Projects} />
177-
<Redirect from={routes.CR_BY_ID} to={routes.CHANGE_REQUESTS_BY_ID} />
178-
<Route path={routes.CHANGE_REQUESTS} component={ChangeRequests} />
179-
<Route path={routes.GANTT} component={GanttChartPage} />
180-
<Route path={routes.TEAMS} component={Teams} />
181-
<Route path={routes.SETTINGS} component={Settings} />
182-
<Route path={routes.ADMIN_TOOLS} component={AdminTools} />
183-
<Route path={routes.INFO} component={InfoPage} />
184-
<Route path={routes.CREDITS} component={Credits} />
185-
<Route path={routes.FINANCE} component={Finance} />
186-
<Route path={routes.CALENDAR} component={Calendar} />
187-
<Route path={routes.STATISTICS} component={Statistics} />
188-
<Route path={routes.HOME} component={Home} />
189-
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
190-
<Route path={routes.EVENTS} component={GuestEventPage} />
191-
<Redirect from={routes.BASE} to={routes.HOME} />
192-
<Route path="*" component={PageNotFound} />
193-
</Switch>
194-
</Container>
195-
</Box>
63+
<SidebarLayout>
64+
<Switch>
65+
<Route path={routes.PROJECTS} component={Projects} />
66+
<Redirect from={routes.CR_BY_ID} to={routes.CHANGE_REQUESTS_BY_ID} />
67+
<Route path={routes.CHANGE_REQUESTS} component={ChangeRequests} />
68+
<Route path={routes.GANTT} component={GanttChartPage} />
69+
<Route path={routes.TEAMS} component={Teams} />
70+
<Route path={routes.SETTINGS} component={Settings} />
71+
<Route path={routes.ADMIN_TOOLS} component={AdminTools} />
72+
<Route path={routes.INFO} component={InfoPage} />
73+
<Route path={routes.CREDITS} component={Credits} />
74+
<Route path={routes.FINANCE} component={Finance} />
75+
<Route path={routes.CALENDAR} component={Calendar} />
76+
<Route path={routes.STATISTICS} component={Statistics} />
77+
<Route path={routes.HOME} component={Home} />
78+
<Route path={routes.RETROSPECTIVE} component={RetrospectiveGanttChartPage} />
79+
<Route path={routes.EVENTS} component={GuestEventPage} />
80+
<Redirect from={routes.BASE} to={routes.HOME} />
81+
<Route path="*" component={PageNotFound} />
82+
</Switch>
83+
</SidebarLayout>
19684
</AppContextUser>
19785
) : (
19886
<SetUserPreferences userSettings={userSettingsData} />
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* This file is part of NER's FinishLine and licensed under GNU AGPLv3.
3+
* See the LICENSE file in the repository root folder for details.
4+
*/
5+
6+
import { Box } from '@mui/system';
7+
import { Container, IconButton, useTheme } from '@mui/material';
8+
import { useState } from 'react';
9+
import ArrowCircleRightTwoToneIcon from '@mui/icons-material/ArrowCircleRightTwoTone';
10+
import Sidebar from './Sidebar/Sidebar';
11+
import HiddenContentMargin from '../components/HiddenContentMargin';
12+
import { useHomePageContext } from '../app/HomePageContext';
13+
14+
const SidebarLayout: React.FC<{ children: React.ReactNode }> = ({ children }) => {
15+
const theme = useTheme();
16+
const [drawerOpen, setDrawerOpen] = useState(false);
17+
const [moveContent, setMoveContent] = useState(false);
18+
const { onGuestHomePage } = useHomePageContext();
19+
20+
return (
21+
<>
22+
<Box
23+
onMouseEnter={() => {
24+
setDrawerOpen(true);
25+
}}
26+
sx={{
27+
height: '100vh',
28+
position: 'fixed',
29+
width: 15,
30+
borderRight: 2,
31+
borderRightColor: theme.palette.background.paper
32+
}}
33+
/>
34+
<IconButton
35+
onClick={() => {
36+
setDrawerOpen(true);
37+
setMoveContent(true);
38+
}}
39+
sx={{ position: 'fixed', left: -8, top: '3%' }}
40+
id="sidebar-button"
41+
>
42+
<ArrowCircleRightTwoToneIcon
43+
sx={{
44+
fontSize: '30px',
45+
zIndex: 1,
46+
'& path:first-of-type': { color: '#000000' },
47+
'& path:last-of-type': { color: '#ef4345' }
48+
}}
49+
/>
50+
</IconButton>
51+
<Sidebar
52+
drawerOpen={drawerOpen}
53+
setDrawerOpen={setDrawerOpen}
54+
moveContent={moveContent}
55+
setMoveContent={setMoveContent}
56+
/>
57+
<Box display={'flex'}>
58+
<HiddenContentMargin open={moveContent} variant="permanent" />
59+
<Container
60+
maxWidth={false}
61+
sx={{ width: onGuestHomePage && moveContent ? 'calc(100vw - 220px)' : `calc(100vw - 30px)` }}
62+
>
63+
{children}
64+
</Container>
65+
</Box>
66+
</>
67+
);
68+
};
69+
70+
export default SidebarLayout;

src/frontend/src/pages/RetrospectivePage/Retrospective.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ const RetrospectivePage = () => {
200200
)
201201
: add(Date.now(), { weeks: 15 });
202202

203-
const elementId = (element: WbsElementPreview | Task) => (element as WbsElementPreview).id || (element as Task).taskId;
204-
205-
const toggleElementShowChildren = (element: WbsElementPreview | Task) => {
206-
setShowWorkPackagesMap((prev) => new Map(prev.set(elementId(element), !prev.get(elementId(element)))));
207-
};
208-
209203
const headerRight = (
210204
<Box sx={{ display: 'flex', gap: 1, justifyContent: 'flex-end', alignItems: 'center' }}>
211205
<GanttChartColorLegend />

0 commit comments

Comments
 (0)