From 5d3c74b77738c9f6fb746b9965713a53b017eecb Mon Sep 17 00:00:00 2001 From: David Lechner Date: Mon, 19 Dec 2022 14:51:57 -0600 Subject: [PATCH] firmware/dfuWindowsDriverInstallDialog: move instructions in app This replaces the link for Windows DFU USB driver installation instructions with a new in-app dialog containing the instructions. Fixes: https://github.com/pybricks/support/issues/858 --- CHANGELOG.md | 4 + package.json | 2 +- src/app/App.tsx | 2 + src/app/constants.ts | 3 - .../BootloaderInstructions.tsx | 71 +-- .../translations/en.json | 11 +- .../DfuWindowsDriverInstallDialog.test.tsx | 43 ++ .../DfuWindowsDriverInstallDialog.tsx | 407 ++++++++++++++++++ .../dfuWindowsDriverInstallDialog/actions.ts | 14 + .../dfuWindowsDriverInstallDialog.scss | 32 ++ .../dfuWindowsDriverInstallDialog/i18n.ts | 12 + .../dfuWindowsDriverInstallDialog/reducers.ts | 23 + .../translations/en.json | 55 +++ src/firmware/reducers.test.ts | 3 + src/firmware/reducers.ts | 2 + yarn.lock | 10 +- 16 files changed, 654 insertions(+), 40 deletions(-) create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/DfuWindowsDriverInstallDialog.test.tsx create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/DfuWindowsDriverInstallDialog.tsx create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/actions.ts create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/dfuWindowsDriverInstallDialog.scss create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/i18n.ts create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/reducers.ts create mode 100644 src/firmware/dfuWindowsDriverInstallDialog/translations/en.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 02496675..f08969bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,10 +4,14 @@ ## [Unreleased] +### Added +- Added Windows DFU USB driver installation instructions ([support#858]). + ### Changed - Clicking empty area of file list focuses the list ([support#856]). [support#856]: https://github.com/pybricks/support/issues/856 +[support#858]: https://github.com/pybricks/support/issues/858 ## [2.0.0-rc.1] - 2022-12-09 diff --git a/package.json b/package.json index 10de58f9..61cd9051 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@pybricks/firmware": "6.4.0", "@pybricks/ide-docs": "2.6.0", - "@pybricks/images": "^1.2.1", + "@pybricks/images": "^1.3.0", "@pybricks/jedi": "1.6.0", "@pybricks/mpy-cross-v5": "^2.0.0", "@pybricks/mpy-cross-v6": "^2.0.0", diff --git a/src/app/App.tsx b/src/app/App.tsx index a81efb41..60e85603 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -8,6 +8,7 @@ import React, { useEffect, useState } from 'react'; import SplitterLayout from 'react-splitter-layout'; import { useLocalStorage, useTernaryDarkMode } from 'usehooks-ts'; import Activities from '../activities/Activities'; +import DfuWindowsDriverInstallDialog from '../firmware/dfuWindowsDriverInstallDialog/DfuWindowsDriverInstallDialog'; import { InstallPybricksDialog } from '../firmware/installPybricksDialog/InstallPybricksDialog'; import RestoreOfficialDialog from '../firmware/restoreOfficialDialog/RestoreOfficialDialog'; import { useSettingIsShowDocsEnabled } from '../settings/hooks'; @@ -248,6 +249,7 @@ const App: React.VFC = () => { + diff --git a/src/app/constants.ts b/src/app/constants.ts index 674f4f56..01d8bba9 100644 --- a/src/app/constants.ts +++ b/src/app/constants.ts @@ -45,9 +45,6 @@ export const pybricksBluetoothTroubleshootingUrl = export const pybricksUsbDfuTroubleshootingUrl = 'https://github.com/pybricks/support/discussions/688'; -export const pybricksUsbDfuWindowsDriverInstallUrl = - 'https://github.com/pybricks/support/discussions/688#discussioncomment-3201466'; - export const pybricksUsbLinuxUdevRulesUrl = 'https://github.com/pybricks/support/discussions/688#discussioncomment-3239099'; diff --git a/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx b/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx index b03b08ee..f1337b5c 100644 --- a/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx +++ b/src/firmware/bootloaderInstructions/BootloaderInstructions.tsx @@ -5,14 +5,15 @@ import './bootloaderInstructions.scss'; import { Callout, Intent } from '@blueprintjs/core'; import classNames from 'classnames'; import React, { useEffect, useMemo, useRef, useState } from 'react'; +import { useDispatch } from 'react-redux'; import { legoRegisteredTrademark, - pybricksUsbDfuWindowsDriverInstallUrl, pybricksUsbLinuxUdevRulesUrl, } from '../../app/constants'; import ExternalLinkIcon from '../../components/ExternalLinkIcon'; import { Hub, hubHasBluetoothButton, hubHasUSB } from '../../components/hubPicker'; import { isLinux, isWindows } from '../../utils/os'; +import { firmwareDfuWindowsDriverInstallDialogDialogShow } from '../dfuWindowsDriverInstallDialog/actions'; import cityHubMp4 from './assets/bootloader-cityhub-540.mp4'; import cityHubVtt from './assets/bootloader-cityhub-metadata.vtt'; import essentialHubMp4 from './assets/bootloader-essentialhub-540.mp4'; @@ -100,6 +101,7 @@ const recoveryMetadataFileMap: ReadonlyMap = new Map([ const BootloaderInstructions: React.VoidFunctionComponent< BootloaderInstructionsProps > = ({ hubType, recovery, flashButtonText }) => { + const dispatch = useDispatch(); const i18n = useI18n(); const { button, light, lightPattern } = useMemo(() => { @@ -150,33 +152,6 @@ const BootloaderInstructions: React.VoidFunctionComponent< return ( <> - {hubHasUSB(hubType) && isLinux() && ( - - {i18n.translate('warning.linux')}{' '} - - {i18n.translate('warning.learnMore')} - - - - )} - {hubHasUSB(hubType) && isWindows() && ( - - {i18n.translate('warning.windows')}{' '} - - {i18n.translate('warning.learnMore')} - - - - )} -