The editor saga was assuming that main.py always exists, which is not
the case for the first use of the app. This fixes the issue by checking
to see if the file exists before attempting to open it. This also
revealed a bug in fileStorage where the list of files was not populated
during initialization.
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
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 setting will be used to customize the hub name when flashing
firmware. This commit just implements the setting.
Some changes needed to be made to the existing settings infrastructure
since previously it only allowed boolean settings.
This replaces the ace editor with the monaco editor. It fixes quite a
few small paper-cut bugs and should be easier to add code completion
to in the future.
Many of the snippets are omitted but can be added back later if needed.
Otherwise, we have tried to preserve the existing look and feel as much
as possible.