Commit Graph
160 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 b255a145e3 components/ViewHeightSensor: remove view height sensor
This appears to no longer be necessary for correct app height on Android.
2022-12-21 19:44:11 -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
David Lechner 49f3c5d8f3 components: move ViewHeightSensor
we've moved all of the other components already
2022-11-29 10:59:15 -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 072358036a explorer/newFileWizard: update layout
- move switch under template title
- add description text
- style changes
2022-11-08 13:56:38 -06:00
David 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 Lechner 7810a8ee87 components/hubPicker: use images instead of text 2022-10-28 18:01:39 -05:00
David Lechner 3953816350 components/hubPicker: back state with localStorage
This saves the selected hub in localStorage. This will "remember" the
state between app launches and also synchronize the state between
various users of the component. Both of these should mean fewer clicks
required by the user.
2022-07-27 15:30:39 -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 bb6f86ff18 firmware/installPybricksDialog: add bootloader discrimination
Also fix license not showing for newer hubs.
2022-07-20 18:51:45 -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 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 c4c8da967c components/toolbar: types is a types-only file 2022-05-18 11:15:50 -05:00
David Lechner 76475cc79b fix lint errors 2022-05-18 11:12:52 -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 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 6f204a65f6 reorganize src/ directory
Makes for much less scrolling/jumping around.

https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00
David Lechner b30c31f8b7 use shorthand form to map dispatches
https://redux.js.org/style-guide/style-guide#use-the-object-shorthand-form-of-mapdispatch-with-connect
2021-02-01 10:26:05 -06:00
David Lechner 435e367cca add ready for offline message 2021-01-28 21:01:42 -06:00
David Lechner 252c741180 add app install button 2021-01-28 20:21:20 -06:00
David Lechner e59bfd4474 add UI to manually check for update
This adds a button to call the ServiceWorkerRegistration.update()
function. This button will be hidden if there is already an update
pending.

This also adds a button to restart the app to apply the update. This
is nice in case users accidentally close the notification that asks
to restart.

The about button is moved to the new app group in the setting menu.
2021-01-28 15:37:40 -06:00
David Lechner 066a6c7d3d move scrollbar styling to @pybricks/ide-docs
This makes the scrollbar flashing less noticeable, but there is still
a bit of a flash in dark mode due to the fact that we are still
injecting the class in the load event in that case.
2021-01-28 12:45:17 -06:00
David Lechner 952416f36b apply scroll bar styling to docs iframe 2021-01-27 19:14:15 -06:00
David Lechner eb2cf3c956 add global keyboard shortcut for toggling docs
This handles the cases when the editor is not active and the docs pane
is not active and the terminal is not active.
2021-01-27 16:33:03 -06:00
David Lechner 1d7414bd83 add Ctrl-D keyboard shortcut in docs iframe
This way it still works when the docs are focused. Otherwise the browser
would try to bookmark the page.
2021-01-27 16:02:37 -06:00
David Lechner ca8192084d restore docs position after hide/show
Previously, the docs iframe was removed from the DOM when the docs
were hidden. This caused the docs to always go back to the main page
when shown.

This fixes it by using CSS to hide the docs instead of removing them
from the DOM. However, this comes with its own complications regarding
maintaining the scroll position.
2021-01-27 15:38:51 -06:00
David Lechner 64e6b3739e add keyboard shortcut to toggle docs
this is useful for users with small screens
2021-01-27 11:48:51 -06:00
David Lechner 4f00c962e1 finish TODO for checking bluetooth availability 2021-01-27 10:25:08 -06:00
David Lechner eebeec509c don't focus buttons on click
This prevents the navbar buttons from gaining focus when clicked.
This way it prevents losing focus from the editor or terminal.
It also prevents the settings button from being highlighted after
the settings menu is closed.
2021-01-27 10:25:08 -06:00
David Lechner c7803fed19 fix wrong event type on switch
Fixes:

    index.js:1 Warning: Failed prop type: You provided a `checked` prop to a form field without an `onChange` handler. This will render a read-only field. If the field should be mutable use `defaultChecked`. Otherwise, set either `onChange` or `readOnly`.
2021-01-27 10:25:08 -06:00
David Lechner 68fb7e68f2 format scss files 2021-01-27 10:25:08 -06:00
David Lechner 8d77004aed improve print margin contrast in dark mode 2021-01-26 21:33:17 -06:00
David Lechner 547dff7150 better fit of license dialog on small screens 2021-01-26 21:09:45 -06:00
David Lechner afc8e7c628 include offline copy of docs
This grabs the docs via the @pybricks/ide-docs package and copies them
to the build directory with copy-webpack-plugin.

The service worker automatically picks up these files for precache
since they go through webpack.
2021-01-25 21:05:14 -06:00
David Lechner de573407cb Fix crash when tabbing through buttons
This fixes a crash caused by react-dropzone due to the fact that button
elements aren't compatible with whatever react-dropzone is looking for.

    TypeError: rootRef.current.isEqualNode is not a function
    (anonymous function)
    node_modules/react-dropzone/dist/es/index.js:473
    470 |
    471 | var onKeyDownCb = useCallback(function (event) {
    472 |   // Ignore keyboard events bubbling up the DOM tree
    > 473 |   if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
        | ^  474 |     return;
    475 |   }
    476 |

Wrapping it in a div element solves the problem.

Also disable tabIndex on the dropzone to prevent the button from being
focused twice when tabbing through the buttons.
2021-01-24 13:31:42 -06:00
David Lechner 5614bb1747 add check command to editor
This adds a check command ala Mu editor.
2021-01-24 12:27:16 -06:00
David Lechner c209bdb1ac replace settings icon with scaled up version
This is a scaled up version of the icon from blueprintsjs.
2021-01-24 11:27:40 -06:00
David Lechner 73f155d370 add Select All to editor context menu 2021-01-24 10:56:41 -06:00
David Lechner fcb0bf3d9c add Select All to terminal context menu
The usual keyboard shortcut of Ctrl-A is not allowed since that triggers
raw REPL mode in MicroPython.
2021-01-24 10:55:00 -06:00
David Lechner 467627dc75 flash-firmware: drop error on fail to connect
This error is already handled elsewhere.
2021-01-23 17:29:43 -06:00
David Lechner 5d1311216c add notifications for firmware flash errors 2021-01-23 15:27:36 -06:00
David Lechner 0333fa51c0 add developer settings with pseudolocalization
This is currently broken due to https://github.com/Shopify/quilt/pull/1725
2021-01-21 12:37:29 -06:00
David Lechner 91938e34d9 add special notification for unexpected errors
Since these errors are not expected, we want to make it really easy to
report them.
2021-01-21 12:37:29 -06:00
David Lechner bab35e8c45 move progress from status bar to firmware button 2021-01-19 17:20:56 -06:00