Skip to content

Commit a3e6611

Browse files
committed
324 fixes and removed unnecessary comments
1 parent b3b3bbe commit a3e6611

2 files changed

Lines changed: 41 additions & 50 deletions

File tree

src/frontend/src/components/ReactHookEditableList.tsx

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Grid, Button, IconButton, TextField, Stack, InputLabel, Box } from '@mui/material';
22
import DeleteIcon from '@mui/icons-material/Delete';
33
import { FieldArrayWithId, UseFieldArrayRemove, UseFormRegister, UseFieldArrayAppend } from 'react-hook-form';
4+
import { NERButton } from './NERButton';
45

56
interface ReactHookEditableListProps {
67
name: string;
@@ -20,54 +21,44 @@ const ReactHookEditableList: React.FC<ReactHookEditableListProps> = ({
2021
bulletName = 'Item'
2122
}) => {
2223
return (
23-
<>
24-
<Box>
25-
<Grid container spacing={2}>
26-
{
27-
//</Grid><Grid container sx={{ display: 'flex', flexDirection: 'row', flexWrap: 'wrap' }} spacing={2}>
28-
}
29-
{ls.map((_element, i) => {
30-
return (
31-
//Grid container with direction "row", and then each item inside is wrapped in a grid-element
32-
//xs argument: number out of 12, takes up that amount of space
33-
<Grid item sx={{ alignItems: 'center' }} xs={12} md={4}>
34-
<InputLabel>{bulletName + ' ' + (i + 1)}</InputLabel>
35-
<Box sx={{ display: 'flex' }}>
36-
<TextField
37-
required
38-
multiline
39-
placeholder={'Enter a ' + bulletName + '...'}
40-
inputProps={{ style: { fontSize: 14 } }}
41-
minRows={2}
42-
autoComplete="off"
43-
sx={{ width: 12 / 12, padding: 0 }}
44-
{...register(`${name}.${i}.detail`)}
45-
/>
46-
<Stack spacing={0}>
47-
<IconButton
48-
type="button"
49-
onClick={() => remove(i)}
50-
sx={{ mx: 1, my: 0, color: 'red', marginLeft: '15px', borderRadius: '4px', outline: 'solid' }}
51-
>
52-
<DeleteIcon />
53-
</IconButton>
54-
<Box></Box>
55-
</Stack>
56-
</Box>
57-
</Grid>
58-
);
59-
})}
60-
</Grid>
61-
<Button
62-
variant="contained"
63-
color="primary"
64-
onClick={() => append({ bulletId: -1, detail: '' })}
65-
sx={{ my: 2, width: 'max-content', textTransform: 'none' }}
66-
>
67-
{'Add ' + bulletName}
68-
</Button>
69-
</Box>
70-
</>
24+
<Box>
25+
<Grid container spacing={2}>
26+
{ls.map((_element, i) => {
27+
return (
28+
<Grid item sx={{ alignItems: 'center' }} xs={12} md={4}>
29+
<InputLabel>{bulletName + ' ' + (i + 1)}</InputLabel>
30+
<Box sx={{ display: 'flex', alignItems: 'start' }}>
31+
<TextField
32+
required
33+
multiline
34+
placeholder={'Enter a ' + bulletName + '...'}
35+
inputProps={{ style: { fontSize: 14 } }}
36+
minRows={2}
37+
autoComplete="off"
38+
sx={{ width: 12 / 12, padding: 0 }}
39+
{...register(`${name}.${i}.detail`)}
40+
/>
41+
<IconButton
42+
type="button"
43+
onClick={() => remove(i)}
44+
sx={{ mx: 1, color: 'red', marginLeft: '15px', borderRadius: '4px', outline: 'solid' }}
45+
>
46+
<DeleteIcon />
47+
</IconButton>
48+
</Box>
49+
</Grid>
50+
);
51+
})}
52+
</Grid>
53+
<NERButton
54+
variant="contained"
55+
color="primary"
56+
onClick={() => append({ bulletId: -1, detail: '' })}
57+
sx={{ my: 2, width: 'max-content', textTransform: 'none' }}
58+
>
59+
{'Add ' + bulletName}
60+
</NERButton>
61+
</Box>
7162
);
7263
};
7364

src/frontend/src/pages/WorkPackageDetailPage/WorkPackageEditContainer/WorkPackageEditContainer.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,15 @@ const WorkPackageEditContainer: React.FC<WorkPackageEditContainerProps> = ({ wor
222222
ls={expectedActivities}
223223
append={appendExpectedActivity}
224224
remove={removeExpectedActivity}
225-
bulletName="Expected Activities"
225+
bulletName="Expected Activity"
226226
/>
227227
<ReactHookEditableList
228228
name="deliverables"
229229
register={register}
230230
ls={deliverables}
231231
append={appendDeliverable}
232232
remove={removeDeliverable}
233-
bulletName="Deliverables"
233+
bulletName="Deliverable"
234234
/>
235235
<Box textAlign="right" sx={{ my: 2 }}>
236236
<NERFailButton variant="contained" onClick={exitEditMode} sx={{ mx: 1 }}>

0 commit comments

Comments
 (0)