This persists the current docs page so that it is used on page reload
of the app. This is mostly useful for development since users should
not be refreshing the page.
It also remembers the selected page between sessions, so new windows
will open to the previous page.
Checks are added to default back to the docs index page in case the
"remembered" page is no longer valid.
This fixes issues where the index.html page can be served if we have
something that requests a static resource that does not exist. In the
worst case, this would the app appear recursively in the docs pane.
Also remove some unnecessary typing while we are touching this.
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
The useLocalStorage hook synchronizes state between windows. In the
case of the activities tabs, we don't want this state synchronized,
otherwise changing a tab in one window would change the tab in all
open windows.
Instead, we can use sessionStorage so that the state persists when
refreshing or duplicating a browser tab. Local storage is still used
as the default value so that any new window that is opened will use
the last selected state.
Issue: https://github.com/pybricks/support/issues/807
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.
Since the background doesn't change, we shouldn't change the foreground
either. White shows up better than black on the blue, so we prefer the
dark mode styling.
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.
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.
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.
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
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.
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
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