Commit Graph
100 Commits
Author SHA1 Message Date
David Lechner d88ce8998f test: wrap all user calls in act()
Some user events trigger react dom changes. These need to be wrapped in
act() to avoid a warning printed to the console. To be save, we wrap
all instances.
2023-03-10 18:16:27 -06:00
David Lechner 7d3c77664c fix vertical button margin in dialogs 2023-03-08 18:06:49 -06:00
David Lechner af160c99a8 more code coverage 2023-03-08 15:07:16 -06:00
David Lechner 6a9405e653 explorer: add support for importing ZIP
Also add a new dialog to get user input when file names conflict.

Previously, we were not supplying a list of existing files, so existing
files were silently written over.

Fixes: https://github.com/pybricks/support/issues/833
2023-03-07 14:31:12 -06:00
David Lechner 68d7932ef9 NewFileWizard: fix setUseTemplate casing 2023-03-07 14:31:12 -06:00
David Lechner bad7f1b066 app/constants: add zip file extension and mime type 2023-03-07 14:31:12 -06:00
David Lechner 098c8e60ab editor/pybricksMicroPython: add Side to hub template
This is included in pybricks.parameters on all hubs.
2022-12-27 17:35:11 -06:00
David Lechner 9d71bb4734 eslint: enable react-hooks checks
Also fix all errors, which can lead to subtile bugs.

Mostly fixings deps and refactoring to make typescript happy.
2022-12-17 13:56:01 -06:00
David Lechner ee466ac904 yarn: update react-complex-tree to v2.0.0
Includes fixes for breaking changes.
2022-12-17 12:05:52 -06:00
David Lechner 0cb585b3e7 Revert "yarn: update react-complex-tree to v2.0.0"
This reverts commit f0434b50ed.

This requires react >= v18
2022-12-16 18:12:23 -06:00
David Lechner f560370b51 explorer: fix file tree label 2022-12-16 17:54:36 -06:00
David Lechner f0434b50ed yarn: update react-complex-tree to v2.0.0 2022-12-16 17:54:36 -06:00
David Lechner eb4dff4972 explorer: focus file tree when empty area clicked
This adds an event listener to catch focus events when clicking the
empty area below the file list. Users intuitively expect this to focus
the file list.

Fixes: https://github.com/pybricks/support/issues/856
2022-12-16 17:54:36 -06:00
David Lechner a262f44762 explorer: fix focus outline obscured 2022-12-02 11:37:22 -06:00
David Lechner e01fb1fbe9 eslint: strict equality
Enforce use of ===/!== and fix existing issues.
2022-11-23 17:20:45 -06:00
David Lechner 1d9dd82191 explorer/sagas: don't show error on user cancel
fileSave can raise DomException+AbortError if use clicks cancel in the
OS file dialog. We should not show an error message in this case.
2022-11-23 17:20:45 -06:00
David Lechner bb8015eae5 test: finish TODO for escape key hack
Fix was merged upstream so we can remove the hack.
2022-11-22 15:56:56 -06:00
David Lechner 9fe62467d5 alerts: use shorthand return 2022-11-22 15:56:56 -06:00
David Lechner 072358036a explorer/newFileWizard: update layout
- move switch under template title
- add description text
- style changes
2022-11-08 13:56:38 -06:00
Laurens Valk 68810f071a explorer/newFileWizard: Invert template inclusion UI.
Instead of having the option to delete the template after selecting it, it is more intuitive to have a toggle for including it.
2022-11-08 13:56:38 -06:00
David Lechner 3974613738 activities: fix not scrolling on overflow
This adds css needed to make the activities tab view contents scroll
appropriately when the contents don't fit vertically.

Fixes: https://github.com/pybricks/support/issues/782
2022-11-08 13:56:38 -06:00
David Lechner ede6f80f49 explorer/newFileWizard: add empty file option
Fixes: https://github.com/pybricks/pybricks-code/issues/771
2022-10-28 18:01:39 -05:00
laurensvalkandDavid Lechner a673a45b03 text: Don't say that dashes are allowed. (#1247)
* text: Don't say that dashes are allowed.

This was missed in https://github.com/pybricks/pybricks-code/commit/8b19ad58662186d2295a6241e8c3f84fbfd45809

* explorer/fileNameForGroup: remove dash from translaction dict

Co-authored-by: David Lechner <david@lechnology.com>
2022-10-24 20:07:35 +00:00
David Lechner e5ab52b250 explorer/fileNameFormGroup: fix fix-it for dash in file name 2022-10-19 18:26:37 -05:00
David Lechner fa27649fe3 toasterTypes: change toaster to ref
Instead of rendering the toaster separate from the main index, add it
there so we can inherit all of the context providers. This requires
passing the ref object instead of the toaster instance itself, so
sagas have to be updated.
2022-10-19 18:26:37 -05:00
9994e8f4b4 build(deps): bump jest and @types/jest (#1131)
* build(deps): bump jest and @types/jest

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest). These dependencies needed to be updated together.

Updates `jest` from 28.1.3 to 29.0.3
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.0.3/packages/jest)

Updates `@types/jest` from 28.1.8 to 29.0.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/jest"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* update test snapshots for jest 29

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-13 17:06:24 +00:00
David Lechner d59fe813e9 fix explorer import silently ignored when invalid file name
This finishes a TODO to handle allowing the user to rename a file
with an invalid file name when import files from the file system.

Fixes: https://github.com/pybricks/support/issues/717
2022-08-31 17:39:28 -05:00
David Lechner 3ce644d2b3 explorer/Explorer: work around breaking changes in @testing-library/user-event
@testing-library/user-event "fixed" some hover bugs which broke our
usage, so we need to work around it.
2022-08-03 13:03:18 -05:00
David Lechner c84afea181 style: make use of more blueprint styles
https://blueprintjs.com/docs/#core/typography

Also fix wrapping license text while we are touching this.
2022-07-27 16:55:46 -05:00
David Lechner 3953816350 components/hubPicker: back state with localStorage
This saves the selected hub in localStorage. This will "remember" the
state between app launches and also synchronize the state between
various users of the component. Both of these should mean fewer clicks
required by the user.
2022-07-27 15:30:39 -05:00
David Lechner 8bece7d957 tour: add new tour component 2022-07-27 15:19:36 -05:00
David Lechner d6df128860 i18n: use automatic type inference of translation keys
Finally figured out a way to make typescript strongly type translation
keys so we can avoid the tedium of creating enums of translation keys.
2022-07-22 13:48:50 -05:00
David Lechner 85deb42f76 firmware: add multi-step dialog 2022-07-20 12:32:17 -05:00
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