This changes things up a bit so that files are handled by uuid instead
of path. The allows for files to be renamed without breaking things.
Also some improvements with persistence of the view state for each
file is made.
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.
This starts moving alerts to the same subsystem where they are relevant
instead of putting everything in notifications.
So far, only the explorer file in use error is handled like this.
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 replaces the delete notification with a new alert dialog. This
makes for better keyboard interaction and forces the user to make a
decision before doing anything else.
Also fixes closing the editor before deleting the file.
This refactors the new file wizard to be more independent. Most of the
control is now done through the saga instead of splitting it between
react and the sagas.
Also fix a few issues while we are touching this:
- pressing enter now accepts the dialog
- newly created file is now activated in the editor
This splits the fileStorage archive into two sagas to separate concerns.
fileStorage now just gives a dump of the database and explorer deals
with the user interaction and zipping.
This changes how files work. There is now an open function that
translates a path to a file handle (id). Then this handle is used
to perform other actions on the file. The file contents are moved
to a separate table so that the actual file storage is independent
of the database (e.g. in the future, we may use File Access API).
We store a hash of the file contents in the metadata file so we can
detect file changes without having to compare file contents.
We also separate the change and add actions.
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.
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.
- 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
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].
[1]: https://phryneas.de/redux-typescript-no-discriminating-union
This replaces the localStorage file storage with a new backend that uses
localForage (indexeddb) for storing the file contents. This will also
allow storing multiple files.
This makes use of the new web file system api for a better user
experience when saving a file. It now shows a proper save as dialog
instead of just downloading the file automatically.
Fixes: https://github.com/pybricks/support/issues/84
This adds a firmware version check that shows an error message if the
connected hub is running an older Pybricks firmware version.
Issue: https://github.com/pybricks/support/issues/482
55e724e8d8 introduced <p> elements on
notifications. however this is undesirable on the notification action
text. This splits the Notification component into one that is pre change
and one that is post change.
Fixes #394