Commit Graph
73 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 c8e7e86da0 toolbar/buttons/bluetooth: show progress on disconnect 2023-04-01 13:52:03 -05:00
David 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 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 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 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 876f1f2118 toolbar/ActionButton: drop workaround for https://github.com/palantir/blueprint/issues/5889
This was fixed in @blueprintjs/popover2 v1.12.1
2023-02-01 11:05:43 -06:00
dependabot[bot]andDavid Lechner 7b0dc47b04 build(deps): bump @blueprintjs/popover2 from 1.11.3 to 1.12.0 (#1454)
* build(deps): bump @blueprintjs/popover2 from 1.11.3 to 1.12.0

Bumps [@blueprintjs/popover2](https://github.com/palantir/blueprint/tree/HEAD/packages/core) from 1.11.3 to 1.12.0.
- [Release notes](https://github.com/palantir/blueprint/releases)
- [Changelog](https://github.com/palantir/blueprint/blob/develop/CHANGELOG.md)
- [Commits](https://github.com/palantir/blueprint/commits/@blueprintjs/popover2@1.12.0/packages/core)

---
updated-dependencies:
- dependency-name: "@blueprintjs/popover2"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix breaking change in blueprintjs popover2

work around https://github.com/palantir/blueprint/issues/5889

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Lechner <david@pybricks.com>
2023-01-24 16:18:23 +00: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
David Lechner 7b8970e90f toolbar: add label for a11y 2022-12-16 17:54:36 -06:00
David Lechner 9e62259845 toolbar/ActionButton: use aria-disabled
Since buttons are only styled as disabled, we need to use aria-disabled
to tell screen readers that the button is disabled.
2022-12-16 17:54:36 -06:00
David Lechner a7c6f7abb1 toolbar: fix not focusing first button
This was missed in 85deb42f when the flash button was removed.
2022-12-16 17:54:36 -06:00
David Lechner 303e768168 toolbar/ActionButton: improve focus ring visibility
Since the button and the focus ring are both blue, we need a gap in
order to have enough contrast to see the focus ring.
2022-12-16 17:54:36 -06:00
Laurens Valk 6bc4dbbe99 toolbar/buttons: Copy edit. 2022-12-15 14:59:36 -06:00
David Lechner e12c86781a toolbar: don't wrap buttons
We can have better control over the layout and avoid wrapping by using flex.

Fixes: https://github.com/pybricks/support/issues/841
2022-12-08 17:10:47 -06:00
David Lechner 99760146a6 tour: move button to settings
Since we have the Pybricks logo elsewhere now, we don't need to have
this button on the toolbar. Instead, put it in the settings where it
is out of the way, but can still be used to watch the tour again if
desired.

Some steps are reordered so we don't jump back and forth between
activities since we are starting from the settings tab now.

Also fix changing the selected activities tab when closing the tour.
2022-12-01 17:08:19 -06:00
David Lechner e8b57fe3d9 toolbar/ActionButton: drop aria-haspopup workaround
The fixe has been merged upstream.
2022-11-23 17:20:45 -06:00
David Lechner 9f538490e5 toolbar: remove OpenFileButton
This is no longer used.
2022-11-23 17:20:45 -06:00
David Lechner d323db4d1b toolbar/ActionButton: only disable using style
This removes use of the button disable property since it removes the
button from the accessibility tree and also makes tooltips not work.
The styling is kept the same by manually including the disable style.
2022-11-23 17:20:45 -06:00
David 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 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 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 Lechner b4e1c8293d replace use of deprecated IRef 2022-09-01 11:45:59 -05:00
David Lechner 92431298b2 toolbar/RunButton: enable only when active file
Before multi-file support, it was not possible to have no open file.
So we need to change the state logic to only enable the button when
there is an active file rather than when the editor "is ready".

Fixes: https://github.com/pybricks/support/issues/691
2022-08-12 18:00:57 -05:00
David Lechner e3fece1517 toolbar/TourButton: fix test when env var set
The name depends on the environment and this test failed during release.
2022-07-28 10:32:19 -05:00
David Lechner 8bece7d957 tour: add new tour component 2022-07-27 15:19:36 -05:00
David Lechner d6df128860 i18n: use automatic type inference of translation keys
Finally figured out a way to make typescript strongly type translation
keys so we can avoid the tedium of creating enums of translation keys.
2022-07-22 13:48:50 -05:00
David Lechner 85deb42f76 firmware: add multi-step dialog 2022-07-20 12:32:17 -05:00
David Lechner 90cd4865e8 Add support for MPY ABI v6.
Pybricks firmware v3.2.0b2 has updated to MicroPython 1.19 which
includes breaking changes to the MPY binary file format.
2022-07-06 12:51:01 -05:00
David Lechner 883807b4b4 fix breaking changes for user-event v14 2022-06-02 18:45:28 -05:00
dependabot[bot]andDavid Lechner 0149842803 build(deps): bump react-dropzone from 12.0.4 to 14.2.1 (#843)
* build(deps): bump react-dropzone from 12.0.4 to 14.2.1

Bumps [react-dropzone](https://github.com/react-dropzone/react-dropzone) from 12.0.4 to 14.2.1.
- [Release notes](https://github.com/react-dropzone/react-dropzone/releases)
- [Commits](https://github.com/react-dropzone/react-dropzone/compare/v12.0.4...v14.2.1)

---
updated-dependencies:
- dependency-name: react-dropzone
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* toolbar: update for breaking changes in ReactDropZone

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-06-02 19:58:06 +00:00
David Lechner a3e55c828a move useI18n to i18n.ts
Since we are using the react-i18n babel loader plugin, useI18n can only
be used once per file. Also we have to remember to add the istanbul
ignore next comment each time we use it. By moving this to a common
file, it can be easily copied and pasted when a new submodule is
created and we don't have to remember the rules when calling it.
2022-05-21 13:57:58 -05:00
David Lechner 0839392183 rework roving tab index to use react-aria 2022-05-17 23:20:09 -05:00
David Lechner f7dcf8b0f7 components/toolbar: move from utils
This is a better home.
2022-05-17 11:28:21 -05:00
David Lechner 404818bcdf toolbar: use roving focus 2022-05-13 23:28:12 -05:00
David Lechner dc2daf2fe4 toolbar: hide icons from a11y tools
There are already ARIA labels, so the icons should be hidden.
2022-05-13 14:44:26 -05:00
David Lechner 7322c9d667 utils: drop pointerEventsNone
Not sure why this was used in the first place, but causes non-default
behavior which can be confusing.
2022-05-13 14:39:35 -05:00
David Lechner cd88789be7 toolbar: override aria-haspopup
The Tooltip2 component incorrectly sets this attribute which should
not be set for tooltips.
2022-05-13 14:38:12 -05:00
David Lechner 5dc6b2e4cb util: drop preventBrowserNativeContextMenu
This is done once at the top-level app, so is no longer needed.
2022-05-12 19:20:46 -05:00
David Lechner edd8ebfd64 Add Activities
This adds a new Activities tab list and view similar to VS code. The
Explorer and Settings are migrated to this view.
2022-05-12 12:33:21 -05:00
David Lechner 65623f801d update for breaking blueprintjs style changes
it is no longer feasible to build the blueprintjs css ourselves, so we
just use all of the default variable values and override things using
selectors instead.
2022-05-11 18:13:36 -05:00
David Lechner 5ee74187eb optimize svgs
The new webpack doesn't like the xml namespaces and refuses to compile
so we have to save the svg files in optimized form.
2022-05-10 20:26:58 -05:00
David Lechner 79d5b06136 editor: move isReady state from app
This is a step towards getting rid of the 'editor' context.
2022-03-26 12:03:08 -05:00
David Lechner f36e774d1e coverage: ignore useI18n 2022-03-25 15:54:04 -05:00
David Lechner 5dd61fa4c3 toolbar/buttons: consolidate buttons 2022-03-25 15:54:04 -05:00
David Lechner 9f254f035f i18n: use babel-loader plugin 2022-03-25 15:54:04 -05:00
David Lechner c3c9a8fd7c improve dialog accessability 2022-03-17 11:08:31 -05:00
David Lechner 46faff981d toolbar: add label to buttons
This improves accessability by letting us get buttons by the label.
2022-03-16 15:24:48 -05:00
David Lechner 675d01013d utils/react: drop preventFocusOnClick
We can fix this better with css tweaks.
2022-03-15 21:39:24 -05:00
David Lechner 8e4045449c src: use prop unpacking pattern
This makes the code a bit shorter by not having to use `props.` all of
the time. Also make everything VoidFunctionComponent while we are
touching this.
2022-03-12 16:07:31 -06:00