David Lechner
28f63d5d85
utils/math: add crc32 function
...
This matches the STM32 hardware CRC.
2022-07-21 14:27:27 -05:00
David Lechner
b2b173e103
utils/os: add Linux and iOS
...
Also update to navigator.userAgentData to avoid warnings from chromium.
2022-07-15 12:37:36 -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
48bd65c5b8
fix breaking changes for typescript 4.7
2022-06-03 11:32:36 -05:00
David Lechner
4e88605b16
utils/customError: narrow type of name property
...
The name property is inherited from Error and has a type of string.
But our CustomError ensures that the name is restricted to the type
of T. This causes compiler errors, so we had to enable a babel plugin
to support it.
2022-05-20 16:46:17 -05:00
David Lechner
348d6e90d9
add CustomError class
...
This will be used for throwing errors that can be caught and handled without having to parse the message.
2022-05-20 11:13:55 -05:00
David Lechner
8b6939a983
utils: extract acquireLock function from fileStorage
2022-05-19 12:03:10 -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
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
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
7322c9d667
utils: drop pointerEventsNone
...
Not sure why this was used in the first place, but causes non-default
behavior which can be confusing.
2022-05-13 14:39:35 -05:00
David Lechner
3fb98e6ae1
ViewHeightSensor: hard-code style
...
This style is not about looks, so hard-code it instead of using style sheets.
2022-05-12 19:23:49 -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
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
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