Commit Graph
100 Commits
Author SHA1 Message Date
David LechnerandDavid Lechner 0d1bc4c9fa index.html: fix apple-touch-icon for beta
Beta uses a different icon, so we need to account for that.
2022-11-19 16:58:27 -06:00
David LechnerandDavid Lechner ea84c48159 service-worker: fix caching of app icons
The application icons, like favicon.ico were not being cached properly
and were missing when the app was used offline.

Changing the strategy to CacheFirst and changing the test to include
all images fixes the problem.
2022-11-19 16:58:27 -06:00
David LechnerandDavid Lechner 7850a505e4 about: fix icon not working offline
Issue: https://github.com/pybricks/pybricks-code/issues/1245
2022-11-18 19:28:00 -06:00
David LechnerandDavid 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 LechnerandDavid 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 LechnerandDavid 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 LechnerandDavid 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 LechnerandDavid Lechner f167f168ee fix missing icons
Warning sign was missed in 90b04f8. 20px error and info are added just
in case.
2022-11-18 19:28:00 -06:00
David LechnerandDavid Lechner 745d09df7a constants: add LEGO registered trademark
This shouldn't be translated so we make a constant to ensure that. Also
makes it easy to get the registered trademark symbol which isn't
trivial to type on the keyboard.
2022-11-18 19:28:00 -06:00
David LechnerandDavid Lechner f944948a44 yarn: update to v3.3.0 2022-11-18 19:28:00 -06:00
David LechnerandDavid Lechner 597419be47 ble/alerts/BluetoothNotAvailable: add browser support paragraph
Browsers such as Brave and Opera are based on Chromium but disable
Web Bluetooth. In this case, we can't tell the difference between the
browser not supporting it or the Bluetooth adapter not being present.
So we make the error message cover all possibilities.

Issue: https://github.com/pybricks/support/discussions/804
Issue: https://github.com/pybricks/support/issues/635
2022-11-18 19:28:00 -06:00
David LechnerandDavid Lechner bdf9f3c850 github: update auto-merge workflow
Don't restrict action version. Hopefully fixes warnings about `set-output`.
2022-11-18 19:28:00 -06:00
David LechnerandDavid Lechner d48734b513 ble-pybricks-service/protocol: add CommandType.ResetInUpdateMode 2022-11-18 19:28:00 -06:00
David LechnerandGitHub 06936aa0e6 Merge pull request #1300 from pybricks/dlech
fixes
2022-11-11 13:16:24 -06:00
David Lechner abb4578450 v2.0.0-beta.11 2022-11-11 13:00:40 -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 b2e098f2dd app: catch error when checking for updates
ServiceWorkerRegistration.update() can raise exceptions, so we need to
catch and handle them, otherwise it will crash redux sagas and the app
will stop responding.

Fixes: https://github.com/pybricks/pybricks-code/issues/1299
2022-11-11 13:00:40 -06:00
David LechnerandGitHub 6c906c9cec Merge pull request #1298 from pybricks/dlech
v2.0.0-beta.10
2022-11-11 12:09:18 -06:00
David Lechner e31a567f93 vv2.0.0-beta.10 2022-11-11 12:02:59 -06:00
David LechnerandDavid Lechner 11d3a81426 update @pybricks dependencies 2022-11-11 11:59:51 -06:00
David LechnerandDavid Lechner 992923bf15 SponsorDialog: make team link inline
Also buttons cannot be inside of `<p>` tags.
2022-11-10 13:47:16 -06:00
David LechnerandDavid Lechner 3e50e58206 mpy/sagas: use "new" webpack asset URL
Jest added support for wasm imports which broke our tests. In the mean
time, Webpack 5 added a new asset inclusion mechanism that can work
around this and removes the need for our existing webpack workaround.
2022-11-10 13:47:16 -06:00
David LechnerandDavid Lechner 072358036a explorer/newFileWizard: update layout
- move switch under template title
- add description text
- style changes
2022-11-08 13:56:38 -06:00
David LechnerandDavid Lechner e2f448c12b index: make checked:disabled radio buttons appear unchecked 2022-11-08 13:56:38 -06:00
David LechnerandDavid Lechner 3974613738 activities: fix not scrolling on overflow
This adds css needed to make the activities tab view contents scroll
appropriately when the contents don't fit vertically.

Fixes: https://github.com/pybricks/support/issues/782
2022-11-08 13:56:38 -06:00
David LechnerandDavid Lechner d8b8672793 pybricksMicropython/python-worker: consolidate loadPackage
The pyodide.loadPackage() method can take an array arg, so we don't
have to call it multiple times.
2022-11-08 13:56:38 -06:00
David LechnerandDavid 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 LechnerandDavid Lechner 2d9a0ca39e terminal: focus when repl is requested 2022-10-28 18:01:39 -05:00
David LechnerandDavid Lechner 03f6c004db sponsor: add new button and dialog
Issue: https://github.com/pybricks/support/issues/719
2022-10-28 18:01:39 -05:00
David LechnerandDavid Lechner ede6f80f49 explorer/newFileWizard: add empty file option
Fixes: https://github.com/pybricks/pybricks-code/issues/771
2022-10-28 18:01:39 -05:00
David LechnerandDavid Lechner 7810a8ee87 components/hubPicker: use images instead of text 2022-10-28 18:01:39 -05:00
David LechnerandGitHub 4f09ba444c Merge pull request #1265 from pybricks/dlech
v2.0.0-beta.9
2022-10-27 13:37:13 -05:00
David Lechner e7665a2f9f v2.0.0-beta.9 2022-10-27 13:25:47 -05:00
David LechnerandDavid Lechner 90b04f85b3 webpack: add hack to remove unused icons
This follows the suggestions from [1] to reduce the package size by
only including the icons we are actually using. This gets the main
module small enough to avoid the CRA "The bundle size is significantly
larger than recommended." warning (gzipped size is < 512KB).

[1]: https://github.com/palantir/blueprint/issues/2193
2022-10-27 13:17:51 -05:00
David LechnerandDavid Lechner 694b064683 remove unnecessary {} 2022-10-27 13:17:51 -05:00
David LechnerandDavid Lechner 0725203d66 app: lazy-load terminal
This changes the terminal sagas and components to be lazy loaded to
improve time until first render.
2022-10-27 13:17:51 -05:00
David LechnerandDavid Lechner c49f37f5e4 editor: lazy load
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.

This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.

This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
2022-10-27 13:17:51 -05:00
David LechnerandDavid Lechner 0f56bb7174 app/actions: drop didStart
This action is no longer used.
2022-10-27 13:17:51 -05:00
David LechnerandDavid Lechner 509c635a07 ble/sagas: add workaround for BlueZ quirk
The 'gattserverdisconnected' event is called before the device is
actually disconnected, so if the user tries to connect again
immediately, the web browser will show a still "paired" device, but
selecting this devices results in an infinite wait. This is a bug in
Chromium, but we can work around it by adding a delay to give BlueZ
time to actually disconnect the device.

Closes: https://github.com/pybricks/support/issues/600
2022-10-26 16:20:08 -05:00
David Lechner 57c87da464 editor: disable word-based suggestions
This turns off the default word-based suggestions. This was useful when
we didn't have proper code completion but now can be distracting.

Fixes: https://github.com/pybricks/support/issues/757
2022-10-25 13:48:02 -05:00
David LechnerandDavid Lechner e41a297922 editor: close tab on middle-click
Fixes: https://github.com/pybricks/support/issues/758
2022-10-25 12:57:07 -05:00
David LechnerandGitHub e0dda59c87 Delete dependabot-yarn2.yml
dependabot should support yarn v2 now
2022-10-25 12:49:24 -05:00
David LechnerandGitHub d036195a4e Update dependabot.yml
Schedule during off hours.
2022-10-25 12:48:30 -05:00
David LechnerandGitHub efde030f5f Merge pull request #1259 from pybricks/dlech
v2.0.0-beta.8
2022-10-25 12:00:58 -05:00
David Lechner c763b2ef72 v2.0.0-beta.8 2022-10-25 11:50:06 -05:00
David Lechner ed8394bf84 pybricksMicropython/lib: handle exceptions when parsing
The new code parsing library raises exceptions when there are syntax
errors, so this needs to be handled.

Fixes: https://github.com/pybricks/support/issues/755
2022-10-25 11:50:06 -05:00
David LechnerandGitHub 3b3f8287c0 Merge pull request #1250 from pybricks/dlech
v2.0.0-beta.7
2022-10-24 15:44:47 -05:00
David LechnerandGitHub 335a16e30d Merge branch 'master' into dlech 2022-10-24 15:34:08 -05:00
David Lechner 07b929cde3 v2.0.0-beta.7 2022-10-24 15:30:50 -05:00
David LechnerandDavid Lechner cc37548e36 pybricksMicropython/lib: replace parser
This replaces the Python parsing library. The python-ast package has
really poor performance (many seconds to parse a 500 line file). The
new package can parse a file about 100 times faster.
2022-10-24 15:29:17 -05:00
David Lechner 0e2a0f909a pybricksMicropython/lib: replace parser
This replaces the Python parsing library. The python-ast package has
really poor performance (many seconds to parse a 500 line file). The
new package can parse a file about 100 times faster.
2022-10-24 15:21:52 -05:00
David LechnerandDavid Lechner a3a6e1bc6f CHANGELOG: fix link 2022-10-21 17:09:02 -05:00
David LechnerandGitHub 6e7462a67a Merge pull request #1244 from pybricks/dlech
v2.0.0-beta.6
2022-10-21 16:56:37 -05:00
David Lechner fcffef37d4 v2.0.0-beta.6 2022-10-21 16:26:43 -05:00
David Lechner 6692ab6fae CHANGELOG: update for dependencies and missed changes 2022-10-21 16:26:43 -05:00
David Lechner 397ea60354 ReplButton: disable when hub doesn't support it
Fixes: https://github.com/pybricks/support/issues/743
2022-10-21 16:26:43 -05:00
David Lechner 964c18f12e ble/sagas: fix blePybricksServiceDidNotReceiveHubCapabilities firmware version
We were using the version from the @pybricks/firmware package but we
really want the version from the connected device.
2022-10-21 16:26:43 -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 4400c0663e alerts/UnexpectedErrorAlert: fix not showing message
This was not showing the actual error message.

Also hide the technical details when no stack trace is available.
2022-10-21 16:26:43 -05:00
David LechnerandDavid Lechner 7e726fffaf mpy/alerts: implement compiler error
This shows the output from mpy-cross and has a button to go to the
error.
2022-10-19 18:26:37 -05:00
David LechnerandDavid Lechner e5ab52b250 explorer/fileNameFormGroup: fix fix-it for dash in file name 2022-10-19 18:26:37 -05:00
David LechnerandDavid Lechner fc4cb8eb78 alerts: add alertsHideAlert actions
This is used instead of using toaster.dismiss() directly.
2022-10-19 18:26:37 -05:00
David LechnerandDavid 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 LechnerandDavid 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
David LechnerandDavid Lechner be9272ca9c pybricksMicropython: implement appending imports
This implements appending compiled imported modules for the multi-mpy6
file format.
2022-10-19 18:26:37 -05:00
David LechnerandDavid Lechner 8b19ad5866 pybricksMicropython: don't allow files with dash
Since we are adding user imports, we need to make sure all file names
are valid module names, so this means we can't use a dash.
2022-10-19 18:26:37 -05:00
David LechnerandDavid Lechner 5948952174 hub: fix tooltip when download complete
The tooltip was still showing "Downloading... 100%" after downloading
was complete instead of returning to the normal tooltip.
2022-10-17 13:44:21 -05:00
David LechnerandDavid Lechner bd0b276ea5 hub/sagas: fix scaling of download progress
This was missed in 06b204dd53.

Fixes: https://github.com/pybricks/pybricks-code/issues/1219
2022-10-17 13:44:21 -05:00
David LechnerandDavid Lechner e67ae1c52b use "error" when type is Error
This renames "err" to "error" when the type is Error for consistency
(fixes redux complaints about non-serializable err).
2022-10-17 13:44:21 -05:00
David LechnerandDavid Lechner 06b204dd53 hub/sagas: fix handleDownloadAndRun slicing
Some of the math was assuming i was incremented with ++ instead += chunkSize.
2022-10-17 11:16:28 -05:00
David LechnerandDavid Lechner 960a3163ed add support for Pybricks Profile v1.2.0
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.

Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
2022-10-14 16:21:18 -05:00
David LechnerandDavid Lechner db43cb3e99 remove use of deprecated DomException code property 2022-10-14 16:21:18 -05:00
David LechnerandDavid Lechner eb26bfcf1b index: ignore value action properties
This was making noise in the browser console log.
2022-10-14 16:21:18 -05:00
David LechnerandDavid Lechner 6675310390 spelling 2022-10-14 16:21:18 -05:00
David LechnerandDavid Lechner ce16d15ab0 CHANGELOG: update for 56630ef2 2022-10-14 16:21:18 -05:00
David LechnerandGitHub 6446a81fe1 Merge pull request #1138 from pybricks/dlech
updates
2022-09-14 18:33:26 -05:00
David Lechner ed9510365a Merge remote-tracking branch 'origin/master' into dlech 2022-09-14 18:25:56 -05:00
David Lechner 56630ef2cf firmware/installPybricksDialog: drop support for including custom main.py
This removes the UI and internal support for selecting a file to include
as the main.py when flashing firmware. This feature was removed in the
firmware starting with firmware metadata v2.0.0 so the firmware that
ships with Pybricks code won't be able to do this in the near future.
So, it doesn't make sense to keep this feature only for old firmware.

It is still possible to replace the main.py in old firmware.zip files
and flash that way.
2022-09-14 18:12:34 -05:00
David Lechner 9811807d09 firmware: add support for firmware.metadata.json v2.0.0
This adds support for the new firmware.metadata.json v2.0.0 which drops
support for appending a main.py file to the firmware.
2022-09-14 17:58:54 -05:00
David Lechner c4d98638b1 firmware/actions: fix error type check
we need to check that it matches the error interface, not that it is
an instance of an error
2022-09-14 17:38:19 -05:00
David Lechner 0bd4a7a282 Merge remote-tracking branch 'origin/master' into dlech 2022-09-13 14:24:43 -05:00
David Lechner 7e2404d583 pybricksMicropython: add support for peer file code completion
This allows importing user-created files and getting code completion
for those imports. This is done by mirroring the dexie-based file
system used by the editor to the emscripten based file system used
by pyodide. In the future, ideally we would have some sort of shared
file system, but this works for now.

Note: completing `from ` doesn't list user files/modules because of
filters in the pybricks-jedi python package but completing
`from my_file import ` does work as expected.
2022-09-13 14:19:29 -05:00
David LechnerandGitHub bb61438c26 Merge pull request #1126 from pybricks/dlech
new web server script
2022-09-09 11:48:39 -05:00
David Lechner be36e8e73a Merge remote-tracking branch 'origin/master' into dlech 2022-09-09 11:39:19 -05:00
David Lechner 37527630cf scripts: new web server script
This provides a new script for serving the output of `yarn build`. This
is needed since the app now requires special http headers to be defined
to use certain web APIs.
2022-09-09 11:37:37 -05:00
David Lechner f24db4a89b implement cache bursting based on http header version
In 096eea7, we made use of APIs that require special http headers to be
configured on the server. This had a side effect of causing the
documentation iframe to not load because the browser would cache the
headers of the iframe index.html page.

We can work around this by providing a header version to do cache
bursting via a query parameter on this page.
2022-09-09 11:33:20 -05:00
David LechnerandGitHub c2bd782114 Merge pull request #1124 from pybricks/dlech
fix offline code completion
2022-09-08 13:51:01 -05:00
David Lechner d90aac1d9d Merge remote-tracking branch 'origin/master' into dlech 2022-09-08 13:43:09 -05:00
David Lechner 76462a0f4a python-worker: enable offline use
This makes the required changes to use Pyodide and Python packages
offline and use a fixed version of the Python packages instead of
fetching the latest from PyPI.

There were a number of issues encountered with Pyodide webpack
compatibility that were fixed using `yarn patch`:
- https://github.com/pyodide/pyodide/pull/3080
- https://github.com/pyodide/pyodide/pull/3085
- https://github.com/pyodide/pyodide/issues/3086
- https://github.com/pyodide/pyodide/issues/3087

Issue: https://github.com/pybricks/pybricks-code/issues/932
2022-09-08 13:43:00 -05:00
David LechnerandGitHub 40f2da46d2 Merge pull request #1114 from pybricks/dlech
restore custom firmware flashing
2022-09-06 14:24:53 -05:00
David Lechner ce7295634c Merge remote-tracking branch 'origin/master' into dlech 2022-09-06 14:15:47 -05:00
David Lechner 4e77efb34f installPybricksDialog: add feature to install custom firmware
This restores the ability to drag and drop a custom firmware file to
flash the firmware on the hub.

Fixes: https://github.com/pybricks/pybricks-code/issues/1020
2022-09-06 14:14:57 -05:00
David Lechner ebb8900efe installPybricksDialog: make use of isMounted hook
This simplifies the code a bit by using an existing hook.
2022-09-06 11:10:49 -05:00
David Lechner b447bd7a3a replace use of deprecated IToaster and IToastProps 2022-09-06 10:56:38 -05:00
David Lechner 677d285ef2 installPybricksDialog: move unsupported hubs to separate component 2022-09-03 14:06:25 -05:00
David Lechner b4e1c8293d replace use of deprecated IRef 2022-09-01 11:45:59 -05:00
David LechnerandDavid Lechner d59fe813e9 fix explorer import silently ignored when invalid file name
This finishes a TODO to handle allowing the user to rename a file
with an invalid file name when import files from the file system.

Fixes: https://github.com/pybricks/support/issues/717
2022-08-31 17:39:28 -05:00
David LechnerandGitHub b450c97755 Merge pull request #1077 from pybricks/dependabot/npm_and_yarn/babel-jest-29.0.0
build(deps): bump babel-jest from 28.1.3 to 29.0.0
2022-08-25 12:06:31 -05:00
David LechnerandGitHub a6cc8eec45 Merge pull request #1056 from pybricks/dlech
fixes
2022-08-12 18:07:34 -05:00
David Lechner 122b37da29 firmware/sagas: handle usb error during dfu flash
Fixes: https://github.com/pybricks/pybricks-code/issues/1011
2022-08-12 18:00:57 -05:00