Skip to content

Commit cc5aa4f

Browse files
review
1 parent 5fb0160 commit cc5aa4f

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

src/pages/announcements/add-announcement-form.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,9 @@ export default function AddAnnouncementForm({ onAnnouncementCreated }: Readonly<
103103
<FormContainer<FormSchema>
104104
formContext={formContext}
105105
onSuccess={onSubmit}
106-
//criteriaMode="all"
107-
//mode="all"
108-
mode="onChange"
106+
//criteriaMode="all" ?
107+
mode="onChange" // or maybe mode "all"?
109108
reValidateMode="onChange"
110-
//reValidateMode="onChange"
111109
FormProps={{ style: { height: '100%' } }}
112110
>
113111
<Grid container direction="column" spacing={1.5} height="100%">
@@ -156,9 +154,7 @@ export default function AddAnnouncementForm({ onAnnouncementCreated }: Readonly<
156154
name={MESSAGE}
157155
label={intl.formatMessage({ id: 'announcements.form.message' })}
158156
rows={5} // why does it do nothing even if the field is set as multiline?!
159-
//style={{ height: '100%' }}
160157
fullWidth
161-
//inputProps={{ maxLength: 200 }}
162158
/>
163159
</Grid>
164160
<Grid item xs="auto">

src/pages/announcements/announcements-page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export default function AnnouncementsPage() {
118118
[renderDate, intl, handleDeleteAnnouncement, renderSeverity]
119119
);
120120

121+
const gridContext = useMemo(() => ({ refresh: loadDataAndSave }), [loadDataAndSave]);
122+
121123
// Note: using <Stack/> for the columns didn't work
122124
return (
123125
<Grid container spacing={2} marginLeft={'2px' /*Grid.spacing is in px?*/}>
@@ -150,7 +152,7 @@ export default function AnnouncementsPage() {
150152
defaultColDef={defaultColDef}
151153
gridId="table-announcements"
152154
getRowId={getRowId}
153-
context={useMemo(() => ({ refresh: loadDataAndSave }), [loadDataAndSave])}
155+
context={gridContext}
154156
/>
155157
</Grid>
156158
</Grid>

src/pages/announcements/cancel-cell-renderer.tsx

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,19 @@
66
*/
77
import type { UUID } from 'crypto';
88
import { useCallback } from 'react';
9-
import { IconButton, Tooltip } from '@mui/material';
9+
import { IconButton, type IconButtonProps, Tooltip } from '@mui/material';
1010
import { Delete } from '@mui/icons-material';
1111
import { FormattedMessage } from 'react-intl';
1212

13-
export type CancelButtonCellRendererProps = { value: UUID; onClickHandler: Function };
13+
export type CancelButtonCellRendererProps = { value: UUID; onClickHandler: (value: UUID) => void };
1414

1515
export default function CancelCellRenderer({ value, onClickHandler }: Readonly<CancelButtonCellRendererProps>) {
16+
const handleClick = useCallback<NonNullable<IconButtonProps['onClick']>>(() => {
17+
onClickHandler(value);
18+
}, [onClickHandler, value]);
1619
return (
1720
<Tooltip title={<FormattedMessage id="announcements.table.cancel" />}>
18-
<IconButton
19-
disableRipple
20-
color="secondary"
21-
onClick={useCallback(() => {
22-
onClickHandler(value);
23-
}, [onClickHandler, value])}
24-
>
21+
<IconButton disableRipple color="secondary" onClick={handleClick}>
2522
<Delete fontSize="medium" />
2623
</IconButton>
2724
</Tooltip>

0 commit comments

Comments
 (0)