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.
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
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.
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
This makes the required changes needed to make the editor components
and sagas lazy-load to improve the time before the first render of the
app.
This is done by making sure we only import types from the monaco editor
module anywhere other than the saga and the component modules and using
React.lazy to lazy-load the component and start the sagas.
This cuts the main bundle time to less than 1/2 so load time should be
over twice as fast now.
In 096eea7, we made use of APIs that require special http headers to be
configured on the server. This had a side effect of causing the
documentation iframe to not load because the browser would cache the
headers of the iframe index.html page.
We can work around this by providing a header version to do cache
bursting via a query parameter on this page.
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
This adds the @pybricks/ide-docs package version to the static path.
This should ensure that we don't get a cached older version in the
browser when the ide-docs package is updated.
This prevents the full app from rendering when the last focused item
changes. This item doesn't have an effect on the rendered state so it
shouldn't be stored using state.
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.
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).
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.