Skip to content

Commit dfca47f

Browse files
committed
#1328 code changes
1 parent 57741a0 commit dfca47f

2 files changed

Lines changed: 11 additions & 15 deletions

File tree

src/frontend/src/components/ReactHookEditableList.tsx

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { Grid, Button, IconButton, TextField, InputLabel } from '@mui/material';
2-
import DeleteForeverOutlinedIcon from '@mui/icons-material/DeleteForeverOutlined';
1+
import { Grid, IconButton, TextField, InputLabel } from '@mui/material';
2+
import DeleteIcon from '@mui/icons-material/Delete';
33
import { FieldArrayWithId, UseFieldArrayRemove, UseFormRegister, UseFieldArrayAppend } from 'react-hook-form';
44
import { Box } from '@mui/system';
5+
import { NERButton } from './NERButton';
56

67
interface ReactHookEditableListProps {
78
name: string;
@@ -17,21 +18,16 @@ const ReactHookEditableList: React.FC<ReactHookEditableListProps> = ({ name, ls,
1718
<>
1819
<Grid container columnSpacing={{ xs: 4, sm: 2, md: 3 }}>
1920
{ls.map((_element, i) => {
20-
const formattedName = name
21-
.split(/(?=[A-Z])/)
22-
.map((name) => name.charAt(0).toUpperCase() + name.slice(1))
23-
.join(' ');
24-
2521
return (
26-
<Grid item xs={12} md={6} lg={4}>
22+
<Grid item xs={12} md={6} lg={4} key={`${name}-${i}`}>
2723
<InputLabel sx={{ marginBottom: '5px' }}>
28-
{bulletName ? `${bulletName}` : formattedName} {i + 1}
24+
{bulletName} {i + 1}
2925
</InputLabel>
3026
<Box sx={{ display: 'flex', alignItems: 'start', marginBottom: '20px' }}>
3127
<TextField
3228
required
3329
autoComplete="off"
34-
placeholder={'Enter ' + formattedName + ' . . .'}
30+
placeholder={'Enter ' + bulletName + ' . . .'}
3531
sx={{ width: 12 / 12 }}
3632
multiline
3733
maxRows={3}
@@ -42,21 +38,21 @@ const ReactHookEditableList: React.FC<ReactHookEditableListProps> = ({ name, ls,
4238
onClick={() => remove(i)}
4339
sx={{ mx: 1, color: 'red', marginLeft: '15px', borderRadius: '4px', outline: 'solid' }}
4440
>
45-
<DeleteForeverOutlinedIcon />
41+
<DeleteIcon />
4642
</IconButton>
4743
</Box>
4844
</Grid>
4945
);
5046
})}
5147
</Grid>
52-
<Button
48+
<NERButton
5349
variant="contained"
5450
color="primary"
5551
onClick={() => append({ bulletId: -1, detail: '' })}
5652
sx={{ width: 'max-content', marginBottom: '40px' }}
5753
>
5854
{bulletName ? `+ Add ${bulletName}` : '+ Add new bullet'}
59-
</Button>
55+
</NERButton>
6056
</>
6157
);
6258
};

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const WorkPackageEditContainer: React.FC<WorkPackageEditContainerProps> = ({ wor
223223
ls={expectedActivities}
224224
append={appendExpectedActivity}
225225
remove={removeExpectedActivity}
226-
bulletName="Expected Activities"
226+
bulletName="Expected Activity"
227227
/>
228228
<Typography variant="h5">Deliverables</Typography>
229229
<ReactHookEditableList
@@ -232,7 +232,7 @@ const WorkPackageEditContainer: React.FC<WorkPackageEditContainerProps> = ({ wor
232232
ls={deliverables}
233233
append={appendDeliverable}
234234
remove={removeDeliverable}
235-
bulletName="Deliverables"
235+
bulletName="Deliverable"
236236
/>
237237
<Box textAlign="right" sx={{ my: 2 }}>
238238
<NERFailButton variant="contained" onClick={exitEditMode} sx={{ mx: 1 }}>

0 commit comments

Comments
 (0)