Commit Graph
74 Commits
Author SHA1 Message Date
David Lechner 65e5627568 update to blueprintjs 5.x 2023-06-28 14:42:55 -05:00
David 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 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 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 525faa1670 settings: Copy edit. 2022-12-15 14:59:36 -06:00
Laurens Valk 3e56a6b493 editor/translations: Copy edit. 2022-12-15 14:59:36 -06:00
David Lechner cc20ab8c35 editor: move docs toggle from settings
This removes the docs toggle switch from the settings and adds a new
docs toggle button to the editor.

Fixes: https://github.com/pybricks/support/issues/778
2022-12-06 15:38:58 -06:00
David Lechner 05445c1b07 settings: use sessionStorage for doc state
This adds use of sessionStorage for the documentation visibility toggle.
This way, when multiple windows are open, the docs can be controlled
separately in each window. Local storage is still used as the default
value for new windows.

Issue: https://github.com/pybricks/support/issues/807
2022-12-06 15:38:58 -06:00
David Lechner a262f44762 explorer: fix focus outline obscured 2022-12-02 11:37:22 -06:00
Laurens Valk 545cf786af settings: Move Welcome Tour to Help. 2022-12-02 09:20:08 +01: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
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 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 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 Lechner 5b71c7314a app/App: move firmware flash dialogs from settings
The flash firmware dialog show action can be triggered even when the
settings panel is not mounted, so we need to move the dialogs up in
the tree to the app level.

Fixes: https://github.com/pybricks/support/issues/694
2022-08-12 18:00:57 -05:00
David Lechner 90b459d5db firmware/restoreOfficialDialog: add new dialog 2022-07-27 18:17:20 -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 883807b4b4 fix breaking changes for user-event v14 2022-06-02 18:45:28 -05:00
David Lechner 69ca51fbbb explorer: fix broken layout
Applying this control tweak globally broke the explorer layout. So we
now apply it to settings only.
2022-05-30 10:15:10 -05: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 ef7f6d15c4 improve focus styles 2022-05-16 21:59:58 -05:00
David Lechner 8ba4d49e3b components: add new component to fix a11y issues 2022-05-15 23:27:55 -05:00
David Lechner 728e7c3b26 settings: change tooltips to help buttons
This is more friendly for touch screen users.
2022-05-14 11:09:41 -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 e0a6926d01 explorer: implement duplicate file feature 2022-04-08 18:11:09 -05:00
David Lechner 0715ce3de1 drop settingsToggleShowDocs
We can change the event handler in App.tsx do we no longer need the
settingsToggleShowDocs action or related sagas.
2022-03-25 18:05:03 -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 f17e32af61 settings/SettingsDrawer: work around tooltip bug 2022-03-16 13:07:10 -05:00
David Lechner cb3f22fc9b settings/SettingsDrawer: do not focus hub name label 2022-03-15 21:49:34 -05:00
David Lechner a4660e979c settings: switch to useTernaryDarkMode
useDarkMode kept reverting back to the system default during development
2022-03-15 17:40:46 -05:00
David Lechner 7726dbe01d settings: convert hubName to react hook 2022-03-15 17:25:20 -05:00
David Lechner 861ea34d86 settings: convert flashCurrentProgram to react hook 2022-03-15 16:54:49 -05:00
David Lechner d18ad41e39 settings: add about dialog button test 2022-03-15 15:53:03 -05:00
David Lechner 6cfc37b947 settings: use react hook for showDocs setting
The moves the setting from redux state to a react hook.
2022-03-15 15:35:45 -05:00
David Lechner 9518a21241 settings: replace darkMode with useDarkMode hook
This is a minor breaking change for users that don't have dark mode
set to the default value since the localStorage key has changed (hard-
coded in 3rd party library).
2022-03-14 16:39:17 -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
David Lechner c51669c357 fix deps in hotkeys memos 2022-03-12 15:19:50 -06:00
David Lechner 8d4b42875a settings: fix use of deprecated Drawer.SIZE_* 2022-03-12 15:19:50 -06:00
David Lechner de7e046d31 avoid lambda props
This fixes the simple cases of callback props using lambda functions.
This will prevent rerendering in some cases since a new callback
function is not created on each call.
2022-03-12 15:19:50 -06:00
David Lechner 31fb3b9e4c test: drop state from AsyncSaga constructor params
This uses the real rootReducer to populate the initial state in the test
AsyncSaga. This way we don't have to populate default values. Since it
isn't used often, we can omit the parameter and just call the updateState()
method after creating the object if modifications are needed.
2022-03-11 16:04:09 -06:00
David Lechner 1469d2146e app: rework service worker registration
- registration is moved from top-level index to app/sagas.
- mock implementation is provided for tests
- actions are renamed to include "app" prefix
- actions are changed to not use non-serializable arguments
- reducers are changed to not use non-serializable state
2022-03-09 15:48:30 -06:00
David Lechner 907826cf0e app: rework BeforeInstallPromptEvent
This removed passing the BeforeInstallPromptEvent as an action argument
(action arguments should be serializable). Instead the saga just keeps
a reference to the event and actions are used only to resolve the state
of the UI.
2022-03-08 13:37:43 -06:00