Skip to content

Commit c6f13ef

Browse files
authored
Merge pull request #1704 from Northeastern-Electric-Racing/#1325-refactor-editprojectcontainer
#1325 refactor editprojectcontainer
2 parents f66b1c7 + dfac906 commit c6f13ef

14 files changed

Lines changed: 582 additions & 325 deletions

File tree

src/backend/src/routes/projects.routes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ projectRouter.post(
3636
'/create',
3737
intMinZero(body('carNumber')),
3838
body('teamIds').isArray(),
39-
intMinZero(body('teamIds.*')),
39+
nonEmptyString(body('teamIds.*')),
4040
body('budget').optional().isInt({ min: 0 }).default(0),
4141
...projectValidators,
4242
validateInputs,

src/backend/src/services/projects.services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export default class ProjectsService {
8585
teamIds: string[],
8686
budget: number | null,
8787
linkCreateArgs: LinkCreateArgs[] | null,
88-
rules: string[] | null,
88+
rules: string[],
8989
goals: { id: number; detail: string }[] | null,
9090
features: { id: number; detail: string }[] | null,
9191
otherConstraints: { id: number; detail: string }[] | null,

src/frontend/src/components/Link/LinksEditView.tsx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
import { useAllLinkTypes } from '../../hooks/projects.hooks';
22
import LoadingIndicator from '../LoadingIndicator';
33
import ErrorPage from '../../pages/ErrorPage';
4-
import { Button, IconButton, MenuItem, Select, TextField } from '@mui/material';
4+
import { IconButton, MenuItem, Select, TextField } from '@mui/material';
55
import { FieldArrayWithId, UseFieldArrayAppend, UseFieldArrayRemove, UseFormRegister, UseFormWatch } from 'react-hook-form';
66
import DeleteIcon from '@mui/icons-material/Delete';
77
import { getRequiredLinkTypeNames } from '../../utils/link.utils';
8-
import { ProjectEditFormInput } from '../../pages/ProjectDetailPage/ProjectEdit/ProjectEditContainer';
8+
import { ProjectFormInput } from '../../pages/ProjectDetailPage/ProjectForm/ProjectForm';
99
import { Box } from '@mui/system';
10+
import { NERButton } from '../NERButton';
1011

1112
const LinksEditView: React.FC<{
1213
ls: FieldArrayWithId[];
13-
register: UseFormRegister<ProjectEditFormInput>;
14-
watch: UseFormWatch<ProjectEditFormInput>;
14+
register: UseFormRegister<ProjectFormInput>;
15+
watch: UseFormWatch<ProjectFormInput>;
1516
append: UseFieldArrayAppend<any, any>;
1617
remove: UseFieldArrayRemove;
1718
}> = ({ ls, register, append, remove, watch }) => {
@@ -66,14 +67,14 @@ const LinksEditView: React.FC<{
6667
);
6768
})}
6869
{availableOptions.length > 0 && (
69-
<Button
70+
<NERButton
7071
variant="contained"
71-
color="success"
72+
color="primary"
7273
onClick={() => append({ linkId: '-1', url: '', linkTypeName: '-1' })}
7374
sx={{ my: 2, width: 'max-content' }}
7475
>
7576
+ Add New Link
76-
</Button>
77+
</NERButton>
7778
)}
7879
</>
7980
);

src/frontend/src/components/PageLayout.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface PageLayoutProps {
1515
previousPages?: LinkItem[];
1616
headerRight?: ReactNode;
1717
tabs?: ReactElement;
18+
stickyHeader?: boolean;
1819
}
1920

2021
const PageLayout: React.FC<PageLayoutProps> = ({
@@ -23,15 +24,16 @@ const PageLayout: React.FC<PageLayoutProps> = ({
2324
hidePageTitle = false,
2425
previousPages = [],
2526
headerRight,
26-
tabs
27+
tabs,
28+
stickyHeader
2729
}) => {
2830
return (
2931
<Box>
3032
<Helmet>
3133
<title>{`FinishLine ${title && `| ${title}`}`}</title>
3234
<meta name="description" content="FinishLine Project Management Dashboard" />
3335
</Helmet>
34-
{!hidePageTitle && title && <PageTitle {...{ title, previousPages, headerRight, tabs }} />}
36+
{!hidePageTitle && title && <PageTitle sticky={stickyHeader} {...{ title, previousPages, headerRight, tabs }} />}
3537
{children}
3638
</Box>
3739
);

src/frontend/src/layouts/PageTitle/PageTitle.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* See the LICENSE file in the repository root folder for details.
44
*/
55

6-
import { Typography, Box, Grid } from '@mui/material';
6+
import { Typography, Box, Grid, useTheme } from '@mui/material';
77
import { ReactElement, ReactNode } from 'react';
88
import { LinkItem } from '../../utils/types';
99
import PageBreadcrumbs from './PageBreadcrumbs';
@@ -13,6 +13,7 @@ interface PageTitleProps {
1313
previousPages: LinkItem[];
1414
headerRight?: ReactNode;
1515
tabs?: ReactElement;
16+
sticky?: boolean;
1617
}
1718

1819
/**
@@ -22,11 +23,22 @@ interface PageTitleProps {
2223
* @param headerRight The button to display on the right side of the page title
2324
* @param tabs The tabs on the page to display.
2425
*/
25-
const PageTitle: React.FC<PageTitleProps> = ({ title, previousPages, headerRight, tabs }) => {
26+
const PageTitle: React.FC<PageTitleProps> = ({ title, previousPages, headerRight, tabs, sticky }) => {
27+
const theme = useTheme();
28+
2629
return (
2730
<>
28-
<PageBreadcrumbs currentPageTitle={title} previousPages={previousPages} />
29-
<Box sx={{ mb: 2 }}>
31+
<Box mb={sticky ? -1 : 0}>
32+
<PageBreadcrumbs currentPageTitle={title} previousPages={previousPages} />
33+
</Box>
34+
<Box
35+
mb={2}
36+
position={sticky ? 'sticky' : 'initial'}
37+
top={65}
38+
pt={sticky ? 1 : 0}
39+
zIndex={1}
40+
bgcolor={theme.palette.background.default}
41+
>
3042
<Grid container>
3143
<Grid item xs={6} md={8}>
3244
<Typography variant="h4" fontSize={30}>

src/frontend/src/pages/ProjectDetailPage/ProjectEdit/ProjectEditContainer.tsx

Lines changed: 0 additions & 261 deletions
This file was deleted.

0 commit comments

Comments
 (0)