100 Commits
Author SHA1 Message Date
David LechnerandDavid Lechner 0472978e50 ble-pybricks-service/sagas: simplify test
I meant to change this before merging the previous commit, but missed it.

The mismatch test was hard to understand and didn't increase coverage,
so let's leave it out.
2024-10-27 18:12:24 -05:00
David LechnerandDavid Lechner baaa9a7920 terminal/sagas: fix handling multibyte unicode
Enable the stream option on the text decode for the stdout and uart
stream handlers that pipe data to the terminal. This fixes improperly
printing multibyte unicode characters that get split across multiple
data packets.

A new decode is added for each different stream in case both are used
at the same time.

Fixes: https://github.com/pybricks/support/issues/1743
2024-09-08 17:52:12 -05:00
David LechnerandDavid Lechner a308303f07 firmware/sagas: revert debug changes
This was missed in the last commit.
2024-09-08 17:19:39 -05:00
David LechnerandDavid Lechner 236ad56148 firmware/sagas: reduce BLE firmware burst size
Mac users have recently been reporting failed firmware updates due to
the hub disconnecting during the update process. This is likely due to
the Mac sending packets faster than the hub can handle. This changes
the arbitrary BLE firmware burst size from 10 to 8 to reduce the chance
of the hub getting overwhelmed.

Fixes: https://github.com/pybricks/support/issues/1787
2024-09-08 17:10:14 -05:00
David LechnerandDavid Lechner d0abe4ea8a config/licenses: add @shopify/name 2024-09-08 16:31:34 -05:00
David LechnerandDavid Lechner b24c247fe9 npx update-browserslist-db@latest 2024-09-08 15:58:58 -05:00
David LechnerandDavid Lechner 36ae3e00c8 depedabot: fix indent 2024-02-19 22:57:31 -06:00
David LechnerandDavid Lechner 3a57f40a93 devcontainer: inital config
This adds a devcontainer config for devs to have an easy way to get a working dev environment.
2024-02-19 22:50:14 -06:00
David LechnerandDavid Lechner 8710cd9c46 editor: fix change in type in monaco-editor 0.45.0 2023-12-16 11:08:49 +01:00
David LechnerandDavid Lechner 870aa88429 config: remove pyodide webpack hack
This is no longer needed since 71ada08 "build(deps): bump @pyodide/webpack-plugin from 1.2.0 to 1.3.2"
2023-11-25 10:59:17 -06:00
David LechnerandDavid Lechner 6bd73fe53a update xterm to beta version
Fixes: https://github.com/pybricks/support/issues/1271
2023-11-18 17:21:44 -06:00
David LechnerandDavid Lechner 5cd0873148 fix centering of logo
For some reason, two is now using the last item in the svg group for
centering, which was one of the eyes. The changes the order so that the
body is not the last item and centering works again.
2023-11-18 17:21:44 -06:00
David LechnerandDavid Lechner c021a77334 add fix for fake-indexeddb v5
https://github.com/dumbmatter/fakeIndexedDB/issues/88
2023-11-18 14:40:16 -06:00
David LechnerandDavid Lechner 5389d59842 fix missing FocusScope in button tests 2023-11-15 17:48:17 -06:00
David LechnerandDavid Lechner 2d968381c4 add assert to work around react-aria typing changes 2023-11-15 17:48:17 -06:00
David LechnerandDavid Lechner 17aaaa7959 fix type error from react-joyride upgrade 2023-11-15 17:00:37 -06:00
David LechnerandDavid Lechner 9644fb483c revert overlay size hack
This broke other stuff by making the overlay present even when there
was no content.
2023-11-12 14:44:00 -06:00
David LechnerandDavid Lechner 7924810b23 fix dialogs on android
Dialogs were off of the screen due to the overlays being bigger than
the view port. This is fixed by adding some style to limit the size.

Also multi-step dialogs are hard-coded to have min-width of 800px in
blueprints.js, so we need to override this on smaller screens.

Fixes: https://github.com/pybricks/support/issues/1271
2023-11-11 18:01:33 -06:00
David LechnerandDavid Lechner 2b63eeffff update @blueprintjs/core@5.6.0 2023-11-11 18:01:33 -06:00
David LechnerandDavid Lechner c03e5782f8 setupTests: fix import for jest-dom v6
Fixes breaking change: https://github.com/testing-library/jest-dom/releases/tag/v6.0.0
2023-11-11 15:12:55 -06:00
David LechnerandDavid Lechner 97f271f722 vscode: fix breaking change in psioniq extension
The extension now has a default typescript config an "*" doesn't
override it so we have to have an explicit "typescript" entry.
2023-09-14 21:28:15 -05:00
David LechnerandDavid Lechner 061d22a7aa prettier v3 changes 2023-08-08 08:15:24 -07:00
David LechnerandDavid Lechner 7bf108087f firmware: disable buttons when DFU in progress
This avoids trying to perform two DFU operations on the same device
at one time. Flashing is so fast, this seems the better option than
trying to support flashing more than one device at a time.

Fixes: https://github.com/pybricks/support/issues/1146
2023-07-12 11:42:53 -05:00
David LechnerandDavid Lechner 2aea540d23 update to React 18 createRoot()
This was overlooked when we updated to React 18. This fixes console
error about using React 17 behavior.

StrictMode had to be disabled because it broke the editor.
2023-07-12 11:42:53 -05:00
David LechnerandGitHub 6b2926ff50 Merge pull request #1889 from pybricks/dlech
v2.2.0-beta.8
2023-07-07 10:55:51 -05:00
David Lechner 39d72b2814 v2.2.0-beta.8 2023-07-07 10:43:09 -05:00
David Lechner 69b3ba21f3 pybricks frimware v3.3.0b8 2023-07-07 10:41:40 -05:00
David LechnerandDavid Lechner 42f96b4ca0 terminal/Terminal: work around xterm cursor style issue
Since updating to Blueprintjs 5.x we can get aliasing artifacts on the
cursor due to bad rendering of box-shadow. This overrides it with
border instead.

https://github.com/xtermjs/xterm.js/issues/4580
2023-07-05 11:06:45 -05:00
David LechnerandGitHub a0f57e3b9f Merge pull request #1872 from pybricks/dlech
v2.2.0-beta.7
2023-07-01 11:19:57 -05:00
David Lechner a50f471e88 v2.2.0-beta.7 2023-07-01 11:09:50 -05:00
David Lechner 3ce7003f10 fix terminal not working
Fixes: https://github.com/pybricks/support/issues/1130
2023-07-01 11:09:08 -05:00
David LechnerandGitHub 83c2fbfe40 Merge pull request #1871 from pybricks/dlech
v2.2.0-beta.6
2023-06-30 11:07:33 -05:00
David Lechner 0d73a37fce v2.2.0-beta.6 2023-06-30 10:55:16 -05:00
David Lechner 32fe69e8fd Pybricks firmware v3.3.0b7 2023-06-30 10:54:24 -05:00
David LechnerandDavid Lechner 65e5627568 update to blueprintjs 5.x 2023-06-28 14:42:55 -05:00
David LechnerandGitHub 7e74fbbaba Merge pull request #1808 from pybricks/dlech
v2.2.0-beta.5
2023-06-02 11:06:28 -05:00
David Lechner 343fa917eb v2.2.0-beta.5 2023-06-02 10:49:07 -05:00
David Lechner dd55d8d76b Pybricks firmware v3.3.0b5 2023-06-02 10:40:24 -05:00
David LechnerandDavid Lechner df84e41061 status-bar: allow selection version
This is useful for copy/pasting version for support.

Fixes: https://github.com/pybricks/support/issues/1083
2023-05-26 15:25:49 -05:00
David LechnerandDavid Lechner fc89c7b329 explorer: active file after duplicating
When duplicating a file users expect the file to be opened as in other
applications.

Fixes: https://github.com/pybricks/support/issues/1084
2023-05-26 11:13:31 -05:00
David LechnerandDavid Lechner 57c2b8a28b editor: add undo stop when switching model
Since we share the same editor instance with multiple models, we need
to ensure undo stack consistency when changing the model, otherwise
we can lose some history, e.g. if a not active model is modified.
2023-05-18 17:06:31 -05:00
David LechnerandDavid Lechner 7351dfb95c editor: fix replacing file when open in editor
When we import/replace a file that is open in an editor, instead of
modifying the file in storage, we need to modify the file in the editor.
This allows the modification to be pushed on the undo stack so that
the user can undo the change in case it wrote over any of their recent
changes.

Issue: https://github.com/pybricks/support/issues/975
2023-05-18 17:06:31 -05:00
David LechnerandDavid Lechner 3fc275eaed fix node 18 type resolution error
After updating to @types/node 18.x, we started getting an error when
mocking FileWithHandle. For some reason, the type hints don't allow
for partial implementation anymore.

Hack around the problem by just casting the partial implementation.
2023-05-18 09:42:07 -05:00
David LechnerandDavid Lechner ce26de9722 yarn dedupe 2023-05-18 09:42:07 -05:00
David LechnerandDavid Lechner c733881815 fix some test console errors
The react testing library prints errors to the console about not using
act(). This adds fixes/workarounds for most cases.
2023-05-17 16:33:47 -05:00
David LechnerandDavid 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 LechnerandGitHub 4f15ac546c Merge pull request #1746 from pybricks/dlech
v2.2.0-beta.4
2023-05-16 16:37:35 -05:00
David Lechner 2edfc7e127 v2.2.0-beta.4 2023-05-16 15:51:28 -05:00
David Lechner 945657d465 update pybricks packages
new firmware + api and docs
2023-05-16 15:49:20 -05:00
David LechnerandDavid Lechner b4db152fca index.scss: change info toast color
The adjusted color made it look like the toast was disabled. Having
buttons the same color as the toast is a bit weird but consistent
with the Blueprintjs style for toasts.
2023-05-15 16:33:47 -05:00
David LechnerandDavid Lechner 4c272d132d yarn: update memfs version
The webpack dev server was crashing in this module. Updating seems to
fix the issue.
2023-05-15 16:33:47 -05:00
David LechnerandDavid Lechner 6d844b78e3 ble-pybricks-service/protocol: add UserProgramMultiMpy6Native6p1
This adds a new flag from Pybricks Profile v1.3.0 for documentation
purposes. We currently don't support native modules in Pybricks Code
so we aren't using this for now.
2023-05-01 12:54:57 -05:00
David LechnerandDavid Lechner e4b6ea0960 editor: don't paste on middle click to close tab
To avoid the Linux feature of pasting on middle click, we need to
consume the mouse up event in the browser on middle click instead of
mouse down.

This also sets the `selectionClipboard` editor option to false which
should disable the feature altogether in the monaco editor but the
setting seems to be broken in the browser[1].

[1]: https://github.com/microsoft/vscode/issues/181050

Fixes: https://github.com/pybricks/support/issues/1046
2023-04-27 12:12:08 -05:00
David LechnerandDavid Lechner be7112c123 hub/sagas: fix not dispatching 100% progress
We were calling the action creator without actually dispatching the
action.

Fixes: https://github.com/pybricks/support/issues/1044
2023-04-25 12:02:30 -05:00
David LechnerandDavid Lechner 1219a377d4 ble/sagas: show alert when Pybricks Profile is newer
If the user sideloads a firmware that has communication features that
are newer than what is supported by the app, then show a warning message.
2023-04-24 17:38:53 -05:00
David LechnerandDavid Lechner 618f7840da always use * as for semver imports
The imported names are very short, so it is helpful to always include
semver.
2023-04-24 17:38:53 -05:00
David LechnerandGitHub 924cfff539 Merge pull request #1709 from pybricks/dlech
v2.2.0-beta.3
2023-04-24 12:40:43 -05:00
David Lechner 56aab66047 CHANGELOG: fix link 2023-04-24 12:08:33 -05:00
David Lechner e3cfe856b9 index.scss: use pybricks blue for info toasts
This makes toasts fit better in the color scheme.
2023-04-24 11:18:13 -05:00
David Lechner 8ac59f3d8d v2.2.0-beta.3 2023-04-24 11:18:03 -05:00
David LechnerandDavid Lechner 0a33c6a24b CHANGELOG: fix copy/pasted firmware version 2023-04-21 16:59:51 -05:00
David LechnerandDavid Lechner 62c4ba013c update to Pybricks firmware v3.3.0b4 2023-04-21 16:59:51 -05:00
David LechnerandDavid Lechner 02a0d974f3 hub/sagas: don't stop user program after connect
Since we now have periodic status messages, we don't need to do anything
to get into a known state.

This caused unexpected behavior when connecting to a hub that is already
connected in a second window.
2023-04-19 13:03:48 -05:00
David LechnerandDavid Lechner 337209744c add support for Pybricks Profile v1.3.0 2023-04-19 13:03:48 -05:00
David LechnerandDavid Lechner 63a1026dae ble-pybricks-service: document @since 2023-04-19 13:03:48 -05:00
David LechnerandDavid Lechner 17ab06d32d hub/reducers: additional coverage 2023-04-19 13:03:48 -05:00
David LechnerandDavid Lechner c8002c743a hub/reducers: fix older firmware mpy version heuristics 2023-04-19 13:03:48 -05:00
David LechnerandDavid Lechner a28ea572ae status-bar: fix height styling
Since this is display: flex, it needs min/max-height instead of plain
height.
2023-04-05 19:27:48 -05:00
David LechnerandDavid Lechner 1e764b4e95 ble/sagas: spawn ble writes
Code depends on always receiving a didWrite/didFailToWrite, however
when a hub disconnected, these tasks were being cancelled. Spawning
protects them from cancellation.
2023-04-01 15:17:22 -05:00
David LechnerandDavid Lechner c8e7e86da0 toolbar/buttons/bluetooth: show progress on disconnect 2023-04-01 13:52:03 -05:00
David LechnerandDavid Lechner 379965e48f toolbar/buttons: debounce short progress
Don't flash progress for short actions like starting repl and stopping
user program. If the hub becomes disconnected, these actions can take
a long time before failing and in that case, we do want to show the
progress indicator.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner 3baaff5b61 ble/sagas: avoid Linux 5 second disconnect when possible
If the user did not request disconnection, then we know this is a true
disconnect event and not an early one so we don't need the delay hack
in that case.

Issue: https://github.com/pybricks/support/issues/600
Issue: https://github.com/pybricks/support/issues/1021
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner 73248fe6aa hub/reducers: simplify Disconnected state logic
Reduce duplicate code by only checking for current state == Disconnected
once.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner 69605ada4a hub/reducers: consolidate command in progress states
The Loaded state is not used anywhere else, so we can replace it with
the Unknown state. Then we can make all other command-in-progress
states (start repl/stop user program) the same as download and run.
When the command completes, the hub is in an unknown state until a
status message is received. The Disconnected states overrides all other
states.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner ce29984be5 hub/sagas: show error if stopping failed
- Finish TODO to show error if stopping fails.
- Make button busy in case waiting for failure takes a long time.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner be3afa167a hub/sagas: fix error message not shown when starting repl
- Add check for repl start command success/fail.
- Show error message on fail.
- Rename start repl action.
- Add new did start/did fail to start repl actions.
- Change terminal saga to use did start repl action to focus terminal.
- Add more tests.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner 70020275a7 ble/alerts/Disconnected: better error message for disconnected
WebBluetooth generally uses DomException with name NetworkError to mean
that Bluetooth is disconnected, so we can use that to provide a helpful
error message.
2023-04-01 13:38:19 -05:00
David LechnerandDavid Lechner 19f6862bb5 hub/reducers: change hub runtime state when disconnecting
When disconnect is requested, we should not longer allow interacting
with the hub, so we say the runtime state is unknown until it is
confirmed to be disconnected.

Fixes: https://github.com/pybricks/support/issues/1021
2023-04-01 13:38:19 -05:00
David LechnerandGitHub 93cce0352f Merge pull request #1650 from pybricks/dlech
v2.2.0-beta.2
2023-03-31 13:37:18 -05:00
David Lechner 91b82ab737 v2.2.0-beta.2 2023-03-31 13:19:36 -05:00
David LechnerandDavid Lechner 7cd986dbd8 Pybricks firmware v3.3.0b3 2023-03-28 10:44:23 -05:00
David LechnerandDavid Lechner be32c37f18 editor/sagas: focus editor when activated
When a file is activated, it is an indication that the user wants to
edit the file right now, so the editor should be focused.
2023-03-28 10:44:23 -05:00
David LechnerandDavid Lechner 38dc8d984d tool-versions: update to node 18
Node 16 reaches end of life in about 6 months so we might as well
update to 18 now since it seems to be working.
2023-03-10 18:16:27 -06:00
David LechnerandDavid Lechner 2f5d11b648 LicenseDialog: fix console errors in tests
useFetch() was trying to actually fetch the license file and mocking
fetch() caused errors about not wrapping code in act(). So instead,
we can avoid all errors by just mocking useFetch() instead.
2023-03-10 18:16:27 -06:00
David LechnerandDavid Lechner 3114ac4e2b mpy/sagas: fix tests attempting to load .wasm via http
Since we are using jsdom, the emscripten generated code doesn't use
the node filesystem lookup for .wasm files. But then it falls back to
node for file:// urls, but this doesn't work because node treats file:
as a drive letter.

We can work around this by modifying the node path.normalize() function
to return the correct path.

Fixes: https://github.com/pybricks/pybricks-code/issues/1584
2023-03-10 18:16:27 -06:00
David LechnerandDavid 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 LechnerandDavid Lechner 78290eb927 github/workflows: update to actions/setup-node@v3
This fixes deprecation warnings about v2 using node 12.
2023-03-10 18:16:27 -06:00
David LechnerandGitHub 6e313c39f1 Merge pull request #1577 from pybricks/dlech
v2.2.0-beta.1
2023-03-08 18:28:31 -06:00
David Lechner 77ba67a38e v2.2.0-beta.1 2023-03-08 18:12:51 -06:00
David Lechner 7d3c77664c fix vertical button margin in dialogs 2023-03-08 18:06:49 -06:00
David Lechner eee8bff17b update Pybricks firmware to v3.3.0b2 2023-03-08 17:49:20 -06:00
David LechnerandDavid Lechner af160c99a8 more code coverage 2023-03-08 15:07:16 -06:00
David LechnerandDavid Lechner 6a9405e653 explorer: add support for importing ZIP
Also add a new dialog to get user input when file names conflict.

Previously, we were not supplying a list of existing files, so existing
files were silently written over.

Fixes: https://github.com/pybricks/support/issues/833
2023-03-07 14:31:12 -06:00
David LechnerandDavid Lechner d9e8a794d0 package.json: patch jsdom to get SubmitEvent
Backport [1] to jsdom 20.

[1]: https://github.com/jsdom/jsdom/pull/3481
2023-03-07 14:31:12 -06:00
David LechnerandDavid Lechner 68d7932ef9 NewFileWizard: fix setUseTemplate casing 2023-03-07 14:31:12 -06:00
David LechnerandDavid Lechner bad7f1b066 app/constants: add zip file extension and mime type 2023-03-07 14:31:12 -06:00
David LechnerandDavid Lechner ea1b377247 github: update more actions versions
fixes deprecation warnings
2023-02-17 16:29:45 -06:00
David LechnerandGitHub 155361727b Merge pull request #1527 from pybricks/dlech
v2.1.1
2023-02-17 16:22:07 -06:00
David Lechner c2d4974a0e v2.1.1 2023-02-17 16:00:55 -06:00
David Lechner 41763c2f9f package.json: update Pybricks firmware to v3.2.3 2023-02-17 15:59:54 -06:00