Skip to content

Commit ed4f630

Browse files
authored
Fix deprecations with Antd.Alert (wpilibsuite#360)
* Fix deprecations with Antd.Alert * Changed visible to open
1 parent a70cb84 commit ed4f630

File tree

7 files changed

+14
-17
lines changed

7 files changed

+14
-17
lines changed

src/reactComponents/AboutModal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ declare const __APP_VERSION__: string;
2727
const __APP_NAME__ = "SystemCore Blocks";
2828

2929
interface AboutDialogProps {
30-
visible: boolean;
30+
open: boolean;
3131
onClose: () => void;
3232
}
3333

3434
const AboutDialog: React.FC<AboutDialogProps> = ({
35-
visible,
35+
open,
3636
onClose,
3737
}) => {
3838
const { t } = useTranslation();
@@ -41,11 +41,11 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
4141
const attributionsFile = '/attributions.txt'; // Path to the attributions file
4242

4343
React.useEffect(() => {
44-
if (visible) {
44+
if (open) {
4545
loadAttributions();
4646
loadDependencies();
4747
}
48-
}, [visible, attributionsFile]);
48+
}, [open, attributionsFile]);
4949
interface LicenseInfo{
5050
name: string;
5151
version: string;
@@ -114,7 +114,7 @@ const AboutDialog: React.FC<AboutDialogProps> = ({
114114
{t('ABOUT.TITLE')}
115115
</Antd.Space>
116116
}
117-
open={visible}
117+
open={open}
118118
footer={[<Antd.Button key="submit" onClick={onClose}>{t('ABOUT.OK')}</Antd.Button>]}
119119
onCancel={onClose}
120120
onOk={onClose}

src/reactComponents/ClassNameComponent.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ export default function ClassNameComponent(props: ClassNameComponentProps): Reac
166166
return (
167167
<Antd.Alert
168168
type="error"
169-
message={alertErrorMessage}
170-
closable
171-
afterClose={handleAlertClose}
169+
title={alertErrorMessage}
170+
closable={{ closeIcon: true, onClose: handleAlertClose}}
172171
style={{marginTop: ERROR_ALERT_MARGIN_TOP}}
173172
/>
174173
);

src/reactComponents/Header.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ export default function Header(props: HeaderProps): React.JSX.Element {
6969
return (
7070
<Antd.Alert
7171
type="error"
72-
message={props.alertErrorMessage}
73-
closable
74-
afterClose={handleClearError}
72+
title={props.alertErrorMessage}
73+
closable={{ closeIcon: true, onClose: handleClearError }}
7574
/>
7675
);
7776
};

src/reactComponents/Menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ export function Component(props: MenuProps): React.JSX.Element {
509509
</div>
510510
)}
511511
<AboutDialog
512-
visible={aboutDialogVisible}
512+
open={aboutDialogVisible}
513513
onClose={() => setAboutDialogVisible(false)}
514514
/>
515515
<ThemeModal

src/reactComponents/ProjectManageModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ export default function ProjectManageModal(props: ProjectManageModalProps): Reac
309309
>
310310
{props.noProjects && (
311311
<Antd.Alert
312-
message={t('NO_PROJECTS_FOUND')}
312+
title={t('NO_PROJECTS_FOUND')}
313313
description={t('CREATE_PROJECT_TO_START')}
314314
type="info"
315315
showIcon

src/reactComponents/ProjectNameComponent.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,8 @@ export default function ProjectNameComponent(props: ProjectNameComponentProps):
134134
return (
135135
<Antd.Alert
136136
type="error"
137-
message={alertErrorMessage}
138-
closable
139-
afterClose={handleAlertClose}
137+
title={alertErrorMessage}
138+
closable={{ closeIcon: true, onClose: handleAlertClose }}
140139
style={{marginTop: ERROR_ALERT_MARGIN_TOP}}
141140
/>
142141
);

src/reactComponents/ThemeModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ const ThemeModal: React.FC<ThemeModalProps> = ({
193193
<Antd.Divider />
194194

195195
<Antd.Alert
196-
message={t('THEME_MODAL.PREVIEW')}
196+
title={t('THEME_MODAL.PREVIEW')}
197197
description={t('THEME_MODAL.PREVIEW_DESCRIPTION')}
198198
type="info"
199199
showIcon

0 commit comments

Comments
 (0)