Commit Graph
50 Commits
Author SHA1 Message Date
David Lechner 56858390ca notifications: allow viewing stack trace of unexpected error
Previously, it was only possible to view the stack trace by clicking
the copy button and pasting it somewhere.
2022-04-07 11:24:07 -05:00
David Lechner c29ca56658 utils: fix defined()
NonNullable means both not undefined and not null.
2022-04-06 18:16:21 -05:00
David Lechner 626dc82b6b tree-renderer: better workaround for focus manager
Changing the focus manager at runtime doesn't work as expected, so we
work around with a css hack instead.
2022-04-05 17:31:47 -05:00
David Lechner 6289f1df92 utils/tree-renderer: do not make icon focusable 2022-04-05 11:13:42 -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 7abdcf85e7 LicenseDialog: make license list keyboard accessible 2022-03-19 21:20:02 -05:00
David Lechner 9de4227ec1 explorer: use keyboard accessible tree 2022-03-19 18:21:00 -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 9518a21241 settings: replace darkMode with useDarkMode hook
This is a minor breaking change for users that don't have dark mode
set to the default value since the localStorage key has changed (hard-
coded in 3rd party library).
2022-03-14 16:39:17 -05:00
David Lechner a2ccd3afdb utils/react: add pointerEventsNone helper
This should prevent some unnecessary rerendering by not creating a new
inline object.
2022-03-12 15:26:48 -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 12f34eb210 utils: add new timestamp function
This will be used to create suggested file names that include a timestamp.
2022-03-01 14:42:45 -06:00
David Lechner a0a1ae7126 "@blueprintjs/core": "^3.53.0"
This allows us to drop the monkey patch to work around an upstream bug.
2022-02-22 14:23:20 -06:00
David Lechner a0da9f7111 Improve code coverage 2022-02-22 12:32:20 -06:00
David Lechner 2f857acbb7 utils/monkey-patch: remove try/catch in test
The try/catch would also suppress the fail() which would make the test
always succeed even when it should fail.

Jest has a .rejects API that can be used instead.
2022-02-22 12:32:19 -06:00
David Lechner fd09783a45 toolbar: work around tooltip bugs
This works around several bugs where tooltips don't close when expected.

Fixes: https://github.com/pybricks/pybricks-code/issues/275
2021-12-28 18:55:20 -06:00
David Lechner 653c03404d utils: remove unused IContextMenuTargets
This is no longer used since refactoring to use function components.
2021-12-27 12:38:51 -06:00
David Lechner db7f3be222 utils: convert ExternalLinkIcon to function 2021-12-27 12:38:50 -06:00
David Lechner 788b77fda0 notifications: add firmware version check
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
2021-09-15 16:49:51 -05:00
David Lechner e7d44ea9a9 src/utils: add ensureError() function
Typescript v4.4 no longer assumes that the error in catch is an Error
object [1]. This adds a helper function to ensure that caught errors
at least match the Error interface. If not, it creates a new Error
object with the value as the message.

[1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#using-unknown-in-catch-variables
2021-08-30 13:06:01 -05:00
David Lechner 56c739fa08 os: add isAndroid() function
This will be used to test if the app is running on Android.
2021-08-12 15:55:24 -05:00
David Lechner c3851e7139 tests: use matchMedia polyfill
This makes testing code that uses window.matchMedia() work better since
it mocks it globally.
2021-07-02 20:59:09 -05:00
David Lechner 6c692a7e95 fix wrapping on external link buttons 2021-06-08 14:52:44 -05:00
David Lechner 956b6f3c96 firmware: add windows BLE hacks
This works around some issues that have been observed on a specific
Windows computer.

Issue: https://github.com/pybricks/support/issues/256
2021-05-16 16:18:34 -05:00
David Lechner 9005e909ba refactor common context menu code 2021-02-01 10:26:06 -06:00
David Lechner 334668bdfb rework mobile view height 2021-02-01 10:26:05 -06:00
David Lechner 6f204a65f6 reorganize src/ directory
Makes for much less scrolling/jumping around.

https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00
David Lechner 252c741180 add app install button 2021-01-28 20:21:20 -06:00
David Lechner 218dda4d0b use typed-redux-saga in flash-firmware sagas
This make things a bit more type safe and a bit easier to read.
2021-01-21 22:22:46 -06:00
David Lechner ab0c850b80 add proper error handling for firmware zip error 2021-01-21 19:49:53 -06:00
David Lechner b38a47f4e6 use os detection for initial dark mode setting 2021-01-15 10:54:57 -06:00
David Lechner 25c0d104a9 convert macOS check to utility function 2021-01-14 15:25:57 -06:00
David Lechner ae996453e8 drop polyfill for chromimum < v85
This removes the polyfill for using older chrome browsers before the
writeWithResponse and writeWithoutResponse APIs were added.
2020-12-21 13:05:47 -06:00
David Lechner 5c3727b3ce Update @types/web-bluetooth
Now includes writeValueWithResponse and writeValueWithoutResponse
2020-07-15 13:17:40 -05:00
David Lechner 61a5eb6039 add xor8 checksum
we are starting with 0xff like all known LEGO checksums of this style.
2020-06-10 21:59:34 -05:00
David Lechner 31c3e2b52e refactor common test helpers into test/
This way we can share them with multiple tests
2020-06-10 21:59:34 -05:00
David Lechner b6be163ccb refactor lookup function 2020-06-08 20:56:00 -05:00
David Lechner 9d789c13e1 add test for util.assert 2020-05-27 20:57:22 -05:00
David Lechner 59c14a3ad7 add test for util.hex 2020-05-27 20:57:22 -05:00
David Lechner 6713afe198 Add util funciton to format as hex 2020-05-26 21:20:08 -05:00
David Lechner dd9d789e9a license 2020-05-22 19:54:48 -05:00
David Lechner 6ef0dee20c test utils/web-bluetooth 2020-05-21 21:27:47 -05:00
David Lechner c979d21255 use describe in math tests
just for better organization
2020-05-21 21:27:47 -05:00
David Lechner ae21501aa2 test sumComplement32 2020-05-21 21:27:47 -05:00
David Lechner ed5bd4728a add id to bootloader request actions
This will be used to match didRequest to a requst to avoid issues with messages being queued concurrently
2020-05-21 21:27:47 -05:00
David Lechner 3b22c0377f add tests for bootloader message decoder
also fix errors found by test
2020-05-21 21:27:47 -05:00
David Lechner 23566a7d4a Check Web Bluetooth capabilities
This adds/improves checks for the various Web Bluetooth capabilities
that we are using and notifies the user when capabilities are missing.
2020-05-20 21:31:51 -05:00
David Lechner 90817a1ae7 github: add CI for pull requests
and hacks to get tests working
2020-05-20 14:52:45 -05:00
David Lechner c7b7162693 implement flashing firmware from new zip format 2020-05-02 14:40:18 -05:00
David Lechner 9d545f8f5c add polyfill for new Web Bluetooth methods 2020-05-01 21:37:45 -05:00