|
| 1 | +// SPDX-License-Identifier: MIT |
| 2 | +// Copyright (c) 2022 The Pybricks Authors |
| 3 | + |
| 4 | +import { Classes, Dialog } from '@blueprintjs/core'; |
| 5 | +import classNames from 'classnames'; |
| 6 | +import React from 'react'; |
| 7 | +import { useDispatch } from 'react-redux'; |
| 8 | +import { |
| 9 | + pybricksBleFirmwareRestoreVideoUrl, |
| 10 | + pybricksDfuRestoreUrl, |
| 11 | +} from '../../app/constants'; |
| 12 | +import { useSelector } from '../../reducers'; |
| 13 | +import ExternalLinkIcon from '../../utils/ExternalLinkIcon'; |
| 14 | +import { firmwareRestoreOfficialDialogHide } from './actions'; |
| 15 | +import { useI18n } from './i18n'; |
| 16 | + |
| 17 | +const RestoreOfficialDialog: React.VoidFunctionComponent = () => { |
| 18 | + const { isOpen } = useSelector((s) => s.firmware.restoreOfficialDialog); |
| 19 | + const dispatch = useDispatch(); |
| 20 | + const i18n = useI18n(); |
| 21 | + |
| 22 | + return ( |
| 23 | + <Dialog |
| 24 | + isOpen={isOpen} |
| 25 | + title={i18n.translate('title')} |
| 26 | + onClose={() => dispatch(firmwareRestoreOfficialDialogHide())} |
| 27 | + > |
| 28 | + <div className={classNames(Classes.DIALOG_BODY, Classes.RUNNING_TEXT)}> |
| 29 | + <h4>{i18n.translate('poweredUpHubs.title')}</h4> |
| 30 | + <p>{i18n.translate('poweredUpHubs.message')}</p> |
| 31 | + <p> |
| 32 | + <a |
| 33 | + href={pybricksBleFirmwareRestoreVideoUrl} |
| 34 | + target="_blank" |
| 35 | + rel="noreferrer" |
| 36 | + > |
| 37 | + {i18n.translate('poweredUpHubs.action')} |
| 38 | + </a> |
| 39 | + <ExternalLinkIcon /> |
| 40 | + </p> |
| 41 | + <h4>{i18n.translate('spikeHubs.title')}</h4> |
| 42 | + <p>{i18n.translate('spikeHubs.message')}</p> |
| 43 | + <p> |
| 44 | + <a href={pybricksDfuRestoreUrl} target="_blank" rel="noreferrer"> |
| 45 | + {i18n.translate('spikeHubs.action')} |
| 46 | + </a> |
| 47 | + <ExternalLinkIcon /> |
| 48 | + </p> |
| 49 | + </div> |
| 50 | + </Dialog> |
| 51 | + ); |
| 52 | +}; |
| 53 | + |
| 54 | +export default RestoreOfficialDialog; |
0 commit comments