firmware/restoreOfficialDialog: add new dialog

This commit is contained in:
David Lechner
2022-07-27 18:17:20 -05:00
parent bbd278b51e
commit 90b459d5db
14 changed files with 152 additions and 28 deletions
+3 -2
View File
@@ -4,7 +4,8 @@
import { cleanup, getByLabelText, waitFor } from '@testing-library/react';
import React from 'react';
import { testRender } from '../../test';
import { firmwareInstallPybricks, firmwareRestoreLego } from '../firmware/actions';
import { firmwareInstallPybricks } from '../firmware/actions';
import { firmwareRestoreOfficialDialogShow } from '../firmware/restoreOfficialDialog/actions';
import Settings from './Settings';
afterEach(() => {
@@ -62,7 +63,7 @@ describe('firmware', () => {
});
await user.click(button);
expect(dispatch).toHaveBeenCalledWith(firmwareRestoreLego());
expect(dispatch).toHaveBeenCalledWith(firmwareRestoreOfficialDialogShow());
});
});
+5 -2
View File
@@ -21,8 +21,10 @@ import {
} from '../app/constants';
import { Button } from '../components/Button';
import HelpButton from '../components/HelpButton';
import { firmwareInstallPybricks, firmwareRestoreLego } from '../firmware/actions';
import { firmwareInstallPybricks } from '../firmware/actions';
import { InstallPybricksDialog } from '../firmware/installPybricksDialog/InstallPybricksDialog';
import RestoreOfficialDialog from '../firmware/restoreOfficialDialog/RestoreOfficialDialog';
import { firmwareRestoreOfficialDialogShow } from '../firmware/restoreOfficialDialog/actions';
import { pseudolocalize } from '../i18n';
import { useSelector } from '../reducers';
import ExternalLinkIcon from '../utils/ExternalLinkIcon';
@@ -108,8 +110,9 @@ const Settings: React.VoidFunctionComponent = () => {
minimal={true}
icon="download"
label={i18n.translate('firmware.flashLegoButton.label')}
onPress={() => dispatch(firmwareRestoreLego())}
onPress={() => dispatch(firmwareRestoreOfficialDialogShow())}
/>
<RestoreOfficialDialog />
</FormGroup>
<FormGroup label={i18n.translate('help.title')}>
<ButtonGroup minimal={true} vertical={true} alignText="left">