Commit Graph
423 Commits
Author SHA1 Message Date
David Lechner 4b3a6fea5e hub: fix missed notification when connecting
This fixes the first notification being missed due to the notification
handler not being started until after notifications are enabled.

It also fixes the DidConnect action changing the state to Unknown after
a notification was received that set the state to a known value.
2021-03-10 10:30:15 -06:00
David Lechner 430147487e implement Pybricks service stop command 2021-03-10 10:30:15 -06:00
David Lechner 61c34fc4b1 implement BLE Pybricks service status notifications
This is the beginning of the BLE Pybricks service implementation, so
changes are made to get a handle to the Pybricks control characteristic
and enable notifications.

Currently, only one event (the status report event) and no commands are
implemented on this characteristic.

The new status report event replaces monitoring the UART for >>>>
strings to get the current hub state.

Also includes some minor cleanup in the ble-uart/actions for consistency.
2021-03-10 10:30:15 -06:00
David Lechner cdd74706c5 toolbar is not a navbar
This adds custom styling for the toolbar (inspired by blueprintsjs
navbar). But this lets us use the correct role and not fight the
navbar styling so much.
2021-02-01 13:02:07 -06:00
David Lechner 1e5d25086b move app version to constants 2021-02-01 13:02:06 -06:00
David Lechner a8b3f5dcf7 use env for app name 2021-02-01 13:02:06 -06:00
David Lechner 9005e909ba refactor common context menu code 2021-02-01 10:26:06 -06:00
David Lechner 714cf8b8cb remove use of ContextMenuTarget from Terminal 2021-02-01 10:26:06 -06:00
David Lechner af964c04b4 use fake redux store in component tests 2021-02-01 10:26:06 -06:00
David Lechner 4b6817d9ad drop use of decorator for editor context menu 2021-02-01 10:26:06 -06:00
David Lechner 6ccb77a5ad add test for snippets 2021-02-01 10:26:06 -06:00
David Lechner 4c5adc20e7 add tests for AboutDialog 2021-02-01 10:26:06 -06:00
David Lechner 36596e9a00 add tests for StatusBar 2021-02-01 10:26:06 -06:00
David Lechner 2955fe1f24 add tests for lwp3-bootloader reducers 2021-02-01 10:26:06 -06:00
David Lechner 922dee31c2 add tests for licenses reducers 2021-02-01 10:26:05 -06:00
David Lechner b7061f63b4 add tests for firmware reducers 2021-02-01 10:26:05 -06:00
David Lechner 6ed5dca8ce add tests for editor reducers 2021-02-01 10:26:05 -06:00
David Lechner bf2bb5e81d add a failed to disconnect action 2021-02-01 10:26:05 -06:00
David Lechner d3e67950a6 add tests for ble reducers 2021-02-01 10:26:05 -06:00
David Lechner ad6e2b73cc make settings open/close local 2021-02-01 10:26:05 -06:00
David Lechner dd951bd4fc make about dialog open/close local 2021-02-01 10:26:05 -06:00
David Lechner 89523b3915 make license dialog state local 2021-02-01 10:26:05 -06:00
David Lechner e5073399a0 drop explicit state interfaces
This could cause subtle bugs like the one fixed here where license
was renamed to licenses.
2021-02-01 10:26:05 -06:00
David Lechner 650888bbf7 add app reducer tests 2021-02-01 10:26:05 -06:00
David Lechner 37b5ebd8f7 app pb-app- prefix to terminal-padding class 2021-02-01 10:26:05 -06:00
David Lechner 334668bdfb rework mobile view height 2021-02-01 10:26:05 -06:00
David Lechner 3c152a48ea remove extraneous console.log() 2021-02-01 10:26:05 -06:00
David Lechner a24c263789 move terminal dataSource to context
state should only hold serializeable data
2021-02-01 10:26:05 -06:00
David Lechner 0c20e52a45 don't allow optional args in actions
This can lead to subtle bugs.

Fixes firmware flash button not working.
2021-02-01 10:26:05 -06: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 8b3606c397 fix check for update button not showing
this happened when the app starts when it is already up to date
2021-01-28 20:37:51 -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 447e7e901b pass registration to reload action 2021-01-28 14:00:09 -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 45ac41b398 use ~ in scss imports
this allows proper click-link to files in node_modules
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