Commit Graph
55 Commits
Author SHA1 Message Date
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
David Lechner 1802bcf796 explorer: push file name validation to parents
This gets rid of the weird unknown state and other problems of trying
to push state from a child back to a parent.
2022-03-19 18:21:00 -05:00
David Lechner 9de4227ec1 explorer: use keyboard accessible tree 2022-03-19 18:21:00 -05:00
David Lechner c3c9a8fd7c improve dialog accessability 2022-03-17 11:08:31 -05:00
David Lechner 675d01013d utils/react: drop preventFocusOnClick
We can fix this better with css tweaks.
2022-03-15 21:39:24 -05:00
David Lechner 8e4045449c src: use prop unpacking pattern
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.
2022-03-12 16:07:31 -06:00
David Lechner de7e046d31 avoid lambda props
This fixes the simple cases of callback props using lambda functions.
This will prevent rerendering in some cases since a new callback
function is not created on each call.
2022-03-12 15:19:50 -06:00
David Lechner c229d407cf utils/react: add preventDefault helpers
These can be used instead of always having to add a comment explaining
what preventDefault does in a given context.
2022-03-12 14:57:30 -06:00
David Lechner d8f958d18e explorer: implement file renaming 2022-03-12 14:45:06 -06:00
David Lechner 31fb3b9e4c test: drop state from AsyncSaga constructor params
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.
2022-03-11 16:04:09 -06:00
David Lechner 93111b6af4 explorer: implement import action 2022-03-11 15:41:16 -06:00
David Lechner e36a30de4c pybricksMicropython/lib: add module
This creates a new module for dealing with stuff specific to Pybricks
MicroPython.
2022-03-11 15:41:16 -06:00
David Lechner 38b9bb6656 explorer: confirm file deletion
Since deleting files cannot be undone, we need to be extra sure before
actually deleting the file.
2022-03-10 13:48:57 -06:00