Commit Graph
112 Commits
Author SHA1 Message Date
David Lechner bf4670b25d update to react 18
We were stuck on react 16.x for a long time but dependencies seem to
have caught up enough that migration is trivial now.
2023-05-17 16:33:47 -05:00
David Lechner d88ce8998f test: wrap all user calls in act()
Some user events trigger react dom changes. These need to be wrapped in
act() to avoid a warning printed to the console. To be save, we wrap
all instances.
2023-03-10 18:16:27 -06:00
David Lechner af160c99a8 more code coverage 2023-03-08 15:07:16 -06:00
David Lechner bad7f1b066 app/constants: add zip file extension and mime type 2023-03-07 14:31:12 -06:00
David Lechner ac00b82cab firmware/installPybricksDialog: fix hub name error icon style 2023-02-16 14:10:07 -06:00
David Lechner 63597e4b88 firmware/installPybricksDialog: only call useFirmware() once
We were unpacking the firmware twice. Instead, we should only call
useFirmware() once and pass the results as props.
2023-02-16 14:10:07 -06:00
David Lechner a841562c6c firmware/installPybricksDialog: remove hard-coded hub name size check
The UI has been rearranged so we now have firmware metadata available
when we validate the hub name.
2023-02-16 14:10:07 -06:00
David Lechner 13c69918e1 firmware/installPybricksDialog: add basic metadata check
This will catch some errors. Mainly this is to ensure we show an error
if someone tries to use, e.g. a NXT firmware file that isn't supported
in Pybricks Code yet. Error message isn't great but we don't expect this
to be hit often, if ever, by non-developers.
2023-02-16 14:10:07 -06:00
David Lechner c8bcddbffd firmware/installPybricksDialog: fix use of useCustomFirmware()
useCustomFirmware() was called multiple times with the same file which
resulted in the same file being parsed 3 times. Instead we should only
call useCustomFirmware() and pass the results as props instead.
2023-02-16 14:10:07 -06:00
David Lechner a77acc1001 firmware/bootloaderInstructions: hide video from tests
The video element makes a bunch of noise (console.error) in tests.
2022-12-22 13:21:02 -06:00
Laurens Valk 44512c9533 firmware/bootloaderInstructions: Clarify hold button text. 2022-12-22 10:20:37 -06:00
David Lechner 808e6c0e85 firmware/bootloaderInstructions: use ol count attribute
Using styles for changing list starting numbers doesn't have good
cross-browser support. We can set the start count using the start
attribute of the ol element instead.

Issue: https://github.com/pybricks/support/issues/868
2022-12-21 16:28:17 -06:00
David Lechner 25231012f6 firmware: consolidate back/next button props
This reduces duplicate code and fixes "Back" not being translated on
the last step.
2022-12-20 12:28:06 -06:00
David Lechner 56dbf57e25 firmware/dfuWindowsDriverInstallDialog: update notListed text
https://github.com/pybricks/pybricks-code/pull/1394#discussion_r1053615293
2022-12-20 12:16:49 -06:00
David Lechner 0c1fd4d30b firmware/dfuWindowsDriverInstallDialog: add Back button translation 2022-12-20 12:15:54 -06:00
David Lechner dd322b5aac tree-wide: use noopener instead of noreferrer for target="_blank"
This will allow us to see when users click links to the pybricks.com
website from the app.
2022-12-20 12:09:04 -06:00
Laurens Valk 7277ddb1bd firmware/dfuWindows: Split properties step.
There may be one of three situations, so split to a bullet list.

Also update a few other strings.
2022-12-20 12:09:04 -06:00
Laurens Valk a7a0f5221b firmware/alerts: Show correct instructions for Linux.
Also link to pybricks website for udev rules instead.
2022-12-20 12:09:04 -06:00
Laurens Valk b6575c5724 firmware/alerts: Add button to install USB driver. 2022-12-20 12:09:04 -06:00
David Lechner 5d3c74b777 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
2022-12-19 15:17:31 -06:00
David Lechner f4598db3a4 use console.error instead of console.log for unexpected errors 2022-12-17 14:04:12 -06:00
David Lechner 9d71bb4734 eslint: enable react-hooks checks
Also fix all errors, which can lead to subtile bugs.

Mostly fixings deps and refactoring to make typescript happy.
2022-12-17 13:56:01 -06:00
Laurens Valk 8b3fa29f65 firmware/installPybricksDialog/translations: Copy edit.
This was missed earlier.
2022-12-17 10:31:40 +01:00
David Lechner b85945ab1d installPybricksDialog: fix heart icon
Use actual icon instead of unicode character. This way it renders the
same on all OSes.
2022-12-16 17:54:36 -06:00
Laurens Valk 9ceaeee739 firmware/installPybricksDialog: Make heart icon variable. 2022-12-15 14:59:36 -06:00
Laurens Valk 4a9f2931d4 firmware/bootloaderInstructions: Group instruction steps. 2022-12-15 14:59:36 -06:00
Laurens Valk e606887319 firmware/bootloaderInstructions: Simplify scss. 2022-12-15 14:59:36 -06:00
Laurens Valk c84d862a57 firmware/alerts: Copy edit. 2022-12-15 14:59:36 -06:00
Laurens Valk 67f05a580d firmware/bootloaderInstructions: Pass flashButtonText directly. 2022-12-15 14:59:36 -06:00
Laurens Valk 3648da6942 firmware/bootloaderInstructions: Copy edit battery instruction. 2022-12-15 14:59:36 -06:00
Laurens Valk 390cf235de firmware/bootloaderInstructions: Keep counting instructions.
This ensures the instruction step counter does not reset after a heading.
2022-12-15 14:59:36 -06:00
Laurens Valk d303e28756 firmware/bootloaderInstructions: Edit unsupported hubs. 2022-12-15 14:59:36 -06:00
Laurens Valk 8aa82eee46 firmware/bootloaderInstructions: Refactor.
- Use steps for the connection procedure
- Use categories (To do: consider making numbering consecutive)
- Show hub bootloader device name explicitly
- List official app to use for recovery (make V2/V3 explicit)
- Copy edit

Also fix the layout (class) of the installation panel to make it consistent with the style of the recovery panel.
2022-12-15 14:59:36 -06:00
Laurens Valk 560da418e0 firmware/bootloaderInstructions/translations: Add prepare section.
Since there are up to three things to prepare, it is better to start the
list with that. We can still keep a separate section for points that match the video.
2022-12-15 14:59:36 -06:00
Laurens Valk 2864fa93be firmware/alerts/translations: Copy edit. 2022-12-15 14:59:36 -06:00
David Lechner 4fcb82e361 bootloaderInstructions: add recovery variant
For official firmware recovery, we have separate videos for non-USB
hubs.

Closes: https://github.com/pybricks/support/issues/728
2022-12-09 15:02:15 -06:00
David Lechner 0f871c6b2c bootloaderInstructions: add videos
This adds videos to show how to enter bootloader mode.

Issue: https://github.com/pybricks/support/issues/728
2022-12-09 13:24:00 -06:00
David Lechner 614e0b0074 firmware: remove android check for chunk size
This should no longer be needed since Chrome v98 (released Nov. 2021).
2022-12-08 17:10:47 -06:00
Laurens Valk 0f02c64800 src/components: Move ClipboardIcon and ExternalLinkIcon from utils.
See https://github.com/pybricks/pybricks-code/pull/1321#pullrequestreview-1190431986
2022-11-25 13:40:44 -06:00
David Lechner 9fe62467d5 alerts: use shorthand return 2022-11-22 15:56:56 -06:00
David Lechner b5b857bca5 firmware/sagas: implement restoring official firmware
Closes: https://github.com/pybricks/pybricks-code/issues/1104
2022-11-18 19:28:00 -06:00
David Lechner cf99ab223d firmware/sagas: refactor firmwareFlashUsbDfu
This allows the firmwareFlashUsbDfu to take an arbitrary binary blob
instead of a Pybricks firmware.zip file. This will allow it to be used
to restore the official LEGO firmware as well.
2022-11-18 19:28:00 -06:00
David Lechner 71c8605773 firmware/restoreOfficialDialog: change to multistep dialog
This gives instructions on how to put the hub in bootloader mode like
the install Pybricks dialog and sets the stage for doing the DFU restore
without going to another website.

Issue: https://github.com/pybricks/pybricks-code/issues/1104
2022-11-18 19:28:00 -06:00
David Lechner 44169bd178 firmware/bootloaderInstructions: extract component
This extracts the instructions for placing a hub in bootloader mode to
a separate component so that it can be shared.
2022-11-18 19:28:00 -06:00
David Lechner 6f91c57743 firmware/sagas: add delay after connecting
This adds a delay after connecting to a hub when flashing firmware via
BLE before sending any commands. This gives the OS Bluetooth stack time
to finish enumerating the Bluetooth device before we start trying to
interact with the device. Hopefully this fixes issues for some people
who are seeing problems while flashing firmware.

Issue: https://github.com/orgs/pybricks/discussions/792
2022-11-11 13:00:40 -06:00
David Lechner cb5101282b firmware/sagas: fix checksum validation
The checksum can be 0, so we can't be lazy and use `!checksum` to test
for undefined.

Issue: https://github.com/pybricks/support/issues/724#issuecomment-1295929316
2022-10-29 14:05:31 -05:00
David Lechner fa00c0aea6 firmware/sagas: fix progress alerts
These were being replaced (dismissed then new alert) instead of updated.
2022-10-21 16:26:43 -05:00
David Lechner fc4cb8eb78 alerts: add alertsHideAlert actions
This is used instead of using toaster.dismiss() directly.
2022-10-19 18:26:37 -05:00
David Lechner 28cf87c356 alerts: allow overriding key
This adds an optional key parameter to alertsShowAlert() to allow
overriding the key. This allows us to call flashProgress using that
action instead of having to use the toaster directly.
2022-10-19 18:26:37 -05:00
David Lechner fa27649fe3 toasterTypes: change toaster to ref
Instead of rendering the toaster separate from the main index, add it
there so we can inherit all of the context providers. This requires
passing the ref object instead of the toaster instance itself, so
sagas have to be updated.
2022-10-19 18:26:37 -05:00