Commit Graph
67 Commits
Author SHA1 Message Date
David Lechner 7232bf6153 add better error message when no files to backup
Instead of showing unexpected error, show message explaining that
there are no files to be backed up and how to fix it.

Fixes: https://github.com/pybricks/support/issues/681
2022-07-06 17:56:08 -05:00
David Lechner 1e0d44bbe4 Fixed deleting files that are not open in the editor. 2022-07-06 17:56:08 -05:00
David Lechner a835934028 explorer: render file toolbar on hover
This improves performance by only rendering the toolbar for each file
when it is actually shown.
2022-06-15 12:03:29 -05:00
David Lechner 883807b4b4 fix breaking changes for user-event v14 2022-06-02 18:45:28 -05:00
David Lechner c26a83f126 explorer/fileNameFormGroup: add "fix it" button
This adds a button on some errors to automatically fix the error.
2022-06-01 12:54:51 -05:00
David Lechner 818865462e editor: handle files by uuid
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.
2022-05-31 17:21:29 -05:00
David Lechner 012d6b029e explorer: fix toolbar buttons wrapping
This fixes the toolbar buttons wrapping when the text overflows.
2022-05-31 12:51:55 -05:00
David Lechner 56e1505f14 Revert "explorer: drop rename feature"
This reverts commit 30741b13ef.
2022-05-30 11:26:35 -05:00
David Lechner e300aa7d64 explorer: explain how to fix error 2022-05-30 11:03:26 -05:00
David Lechner d42b72f1a3 explorer: fix text input not getting focus when clicked
All user controls should stop propagation of events that are handled.
2022-05-30 11:01:29 -05:00
David Lechner a3e55c828a move useI18n to i18n.ts
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.
2022-05-21 13:57:58 -05:00
David Lechner e7366c8afd rework alerts
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.
2022-05-20 19:25:18 -05:00
David Lechner 325562996b replace useUniqueId() with useId()
there should only be one way to do a thing...
2022-05-18 17:16:32 -05:00
David Lechner a005992a21 fileStorage: use dexie-react-hooks
This lets the dexie-react-hooks library do more of the work for us
instead of having to make redux-sagas wrappers for everything.
2022-05-18 17:06:08 -05:00
David Lechner 0839392183 rework roving tab index to use react-aria 2022-05-17 23:20:09 -05:00
David Lechner f7dcf8b0f7 components/toolbar: move from utils
This is a better home.
2022-05-17 11:28:21 -05:00
David Lechner ef7f6d15c4 improve focus styles 2022-05-16 21:59:58 -05:00
David Lechner 9e092ca469 explorer: fix tree item button translations not updating 2022-05-16 01:11:10 -05:00
David Lechner fb681e06ec explorer/fileNameFormGroup: hide tag
screen readers don't need to read the file extension tag
2022-05-13 23:52:21 -05:00
David Lechner f0dcb281de utils: add Toolbar component
This adds a generic toolbar component that follow aria guidelines.
2022-05-13 22:36:01 -05:00
David Lechner a185457067 explorer: don't disable archive button
disabled buttons are bad for accessability
2022-05-13 16:48:32 -05:00
David Lechner a0f8b9a0ca more style and a11y fixes 2022-05-12 20:46:50 -05:00
David Lechner 5dc6b2e4cb util: drop preventBrowserNativeContextMenu
This is done once at the top-level app, so is no longer needed.
2022-05-12 19:20:46 -05:00
David Lechner edd8ebfd64 Add Activities
This adds a new Activities tab list and view similar to VS code. The
Explorer and Settings are migrated to this view.
2022-05-12 12:33:21 -05:00
David Lechner 65623f801d update for breaking blueprintjs style changes
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.
2022-05-11 18:13:36 -05:00
David Lechner e0a6926d01 explorer: implement duplicate file feature 2022-04-08 18:11:09 -05:00
David Lechner 30741b13ef explorer: drop rename feature
It turns out that renaming files while they are open is technically
difficult problem. We will forgo this feature for now.
2022-04-08 14:30:21 -05:00
David Lechner d238e68deb explorer: new delete alert dialog
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.
2022-04-08 12:53:12 -05:00
David Lechner 1c30683b93 explorer: fix wrong file names 2022-04-08 11:58:13 -05:00
David Lechner 825607952f newFileWizard: doc comments 2022-04-08 11:22:46 -05:00
David Lechner 2536e17865 explorer: fix click propagating from action buttons
When the tree item actions buttons were clicked, they were also clicking
the underlying tree item.
2022-04-08 11:04:39 -05:00
David Lechner fad7b0114a explorer/newFileWizard: refactor
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
2022-04-08 10:52:54 -05:00
David Lechner 89a2019a98 explorer: add action for activating file
this simply forwards the action to the editor module
2022-04-05 18:10:06 -05:00
David Lechner 48bc6dbe4d explorer: sort actions
the rename actions were not grouped all together
2022-04-05 17:46:05 -05:00
David Lechner 6e55be056c explorer/reducers: don't use FileMetadata
This separates the explorer files state from the fileStorage FileMetadata.
The latter contains extra info that the explorer doesn't need. This
will prevent rerendering each time the file contents change.
2022-04-05 10:52:11 -05:00
David Lechner c6cf0608f4 explorer: move files state from fileStorage
This state should be exclusivly used to for displaying files in the
explorer, so the state should be in the explorer branch of the
reducer tree.
2022-04-04 18:59:13 -05:00
David Lechner 05731e50fc explorer: split archive saga from fileStorage
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.
2022-04-04 17:48:36 -05:00
David Lechner 7cb0cf3151 test: clean up restoreAllMocks()
clearAllMocks() does not remove mock implementations, so we need to be
using restoreAllMocks() instead. Also ensure that it is called first
in case the other cleanup code needs to call a mocked function.
2022-04-04 15:51:57 -05:00
David Lechner b9dbaaa5cb fileStorage: implement file locks
This breaks down reading and writing into low-level and high level sagas.

Opening now takes a lock on the file so that it can only have one writer
or have multiple readers. The low-level read and write sagas use the
file descriptor to determine if the file is still open before actually
performing the action.

Since we are using the web locks api, these locks should work across
browser tabs/windows.

The high-level read/write sagas perform the low-level open, read/write,
close operations in a single call.

The high-level delete and rename sagas are also updated to take locks
on the files while performing the respective operations and will fail
if the file is already being used somewhere else.
2022-04-04 15:24:08 -05:00
David Lechner 7ef08122e8 explorer: move export from fileStorage 2022-04-01 18:45:24 -05:00
David Lechner 1709591afc fileStorage: untangle file id/name
We were using file UUID and path interchangeable. This adds a new UUID
type for static checking and fixes a bunch of issues found.
2022-04-01 17:24:00 -05:00
David Lechner 1515e5ae4f fileStorage: add file handles
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.
2022-04-01 13:41:10 -05:00
David Lechner 08abd5d277 explorer/fileNameFormGroup: add test 2022-03-25 15:54:05 -05:00
David Lechner 4193383dec explorer/Explorer: hoist button translations
This makes for fewer props to pass.
2022-03-25 15:54:05 -05:00
David Lechner 60c0c820e6 explorer/sagas: rename tests 2022-03-25 15:54:04 -05:00
David Lechner f36e774d1e coverage: ignore useI18n 2022-03-25 15:54:04 -05:00
David Lechner 9f254f035f i18n: use babel-loader plugin 2022-03-25 15:54:04 -05:00
David Lechner 45d0b4071a spelling 2022-03-25 15:54:04 -05:00
David Lechner b16298b08f explorer/renameFileDialog: isolate
This provides more separation between the explorer and the rename file
dialog. This makes writing tests easier and make reading the code easier.
2022-03-25 15:54:04 -05:00
David Lechner 7abdcf85e7 LicenseDialog: make license list keyboard accessible 2022-03-19 21:20:02 -05:00