David Lechner
bc7e9e2a20
fileStorage: add archive actions
...
This allows users to back up all files to their computer.
2022-03-02 10:33:21 -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
a87e2c664c
fileStorage: add export actions
...
These are largely copied from the editor saveAs actions and allow
exporting ("downloading") a file from the browser local storage to
the file system.
2022-03-01 13:44:08 -06:00
David Lechner
80219d297f
licenses/reducers: use ReadonlyArray
...
This helps protect against mistakes in future changes.
2022-03-01 12:00:29 -06:00
David Lechner
55c6841fae
fileStorage/reducers: drop use of Set
...
Using set causes problems with tooling that mocks the global app state,
so stick with arrays.
2022-03-01 11:58:50 -06:00
David Lechner
31600c6f37
editor: fix error if main.py does not exist
...
The editor saga was assuming that main.py always exists, which is not
the case for the first use of the app. This fixes the issue by checking
to see if the file exists before attempting to open it. This also
revealed a bug in fileStorage where the list of files was not populated
during initialization.
2022-02-28 12:24:46 -06:00
David Lechner
97363b4327
actions: improve type inference
...
It seems like there should be a better way to do this.
2022-02-28 12:22:08 -06:00
David Lechner
02d7672155
react-dropzone: fix for breaking change in v12
...
This fixes a breaking change from upgrading to react-dropzone to v12.
2022-02-28 11:01:59 -06:00
David Lechner
994540e263
actions: fix missed refactoring
...
Missed some renames when refactoring that weren't picked up locally
for some reason.
2022-02-26 12:55:49 -06:00
David Lechner
a9f4eaa32d
actions: simplify usage of Matchable
...
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
2022-02-26 12:43:10 -06:00
David Lechner
9641898a75
actions: refactor actions
...
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].
[1]: https://phryneas.de/redux-typescript-no-discriminating-union
2022-02-25 17:58:30 -06:00
David Lechner
8f377b3909
app/actions: fix duplicate type name
...
This fixes a duplicate type name shared by didInstallPrompt and
didInstall actions.
2022-02-25 10:02:26 -06:00
David Lechner
cf8744a6cd
actions: drop typed dispatch
...
This doesn't provide much benefit and is just one more rule to remember,
so we can do without it.
2022-02-24 17:16:52 -06:00
David Lechner
e4b7a9aec7
fileStorage: new file storage backend
...
This replaces the localStorage file storage with a new backend that uses
localForage (indexeddb) for storing the file contents. This will also
allow storing multiple files.
2022-02-24 16:59:49 -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
b3ed75f02b
status-bar: add titles
...
This adds titles to interactive elements. This causes a small (browser-
native) tooltip to display when hovering.
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
54ec447061
actions: added typed useDispatch() hook
2021-12-27 18:01:51 -06:00
David Lechner
8d26f768bf
reducers: use typed useSelector hook
...
This refactors the code to use a typed useSelector() hook.
2021-12-27 17:48:41 -06:00
David Lechner
8527cf86b2
app: refactor dark mode class hook
...
This moves the hook for applying the global dark mode style to the App component.
2021-12-27 17:30:15 -06:00
David Lechner
42051ba924
status-bar: add basic battery indicator
...
This adds a basic battery indicator that just shows green for OK and red
for low battery warning. This is all we can do for now since that is
the only information that the hub sends currently.
Fixes: https://github.com/pybricks/support/issues/559
2021-12-27 17:05:40 -06:00
David Lechner
4c4061561d
ble-nordic-uart-service: rename directory
...
This follows the pattern of other ble service directories.
2021-12-27 13:30:36 -06:00
David Lechner
1e4bce6a14
ble: move sagas
...
This saga uses all ble services, not just NUS, so move it to the common
ble folder.
2021-12-27 13:20:36 -06:00
David Lechner
8d4680ba82
status-bar: add connected hub indicator
...
This adds an indicator to the status bar that shows the hub name. When
clicked, a popover will be displayed that lists more detailed information
about the connected hub.
2021-12-27 13:04:13 -06:00
David Lechner
78dd03d80f
ble-device-info-service/protocol: document PnP ID
...
This explains the Pybricks-specific usage of the PnP ID fields.
2021-12-27 12:38:51 -06:00
David Lechner
5f7a63fe5a
ble-lwp3-service/protocol: add enums for hub types
...
This is the full list of hub types.
2021-12-27 12:38:51 -06:00
David Lechner
0759a0878f
editor: add newlines to end of template
2021-12-27 12:38:51 -06:00
David Lechner
0cc577faad
editor: add Essential hub snippet
2021-12-27 12:38:51 -06:00
David Lechner
ade06ab2cc
ble: add id and name to didConnect action
2021-12-27 12:38:51 -06:00
David Lechner
e92d5c1511
ble-device-info-service: add actions
...
This adds actions that are triggered when the device info service
characteristics are read.
2021-12-27 12:38:51 -06:00
David Lechner
6a9e867fe9
ble-pybricks-service: rename statusReportEvent
...
New name is didReceiveStatusReport which is more consistent with existing
naming patterns.
2021-12-27 12:38:51 -06:00
David Lechner
09b46ed5be
toolbar: make buttons scale with screen size
...
This is very basic, just 2 sizes. But it makes things a bit better
on phones.
Fixes: https://github.com/pybricks/support/issues/300
2021-12-27 12:38:51 -06:00
David Lechner
dfa497fcf6
toolbar: drop no-box-shadow
...
This is now applied to all descendets of pb-toolbar so we don't need the
utility class.
2021-12-27 12:38:51 -06:00
David Lechner
6d0e97f50e
app: fix pb-app div size and background color
2021-12-27 12:38:51 -06:00
David Lechner
b3db3d9efc
app: move docs to sepate comonent
...
The docs iframe is quite complex, so move it to a separate component to
improve readability.
2021-12-27 12:38:51 -06:00
David Lechner
dd0782e8b4
notifications: fix use of deprecated types
2021-12-27 12:38:51 -06:00
David Lechner
f704d4d612
editor: use file system api for save as
...
This makes use of the new web file system api for a better user
experience when saving a file. It now shows a proper save as dialog
instead of just downloading the file automatically.
Fixes: https://github.com/pybricks/support/issues/84
2021-12-27 12:38:51 -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
6dc4dcb2e5
toolbar: specify image width/height
...
This make the button the right size while waiting for the image to download.
Fixes: https://github.com/pybricks/support/issues/369
2021-12-27 12:38:50 -06:00
David Lechner
11e0fefb1d
toolbar: use function form of Dropzone
2021-12-27 12:38:50 -06:00
David Lechner
eb9ea2876e
toolbar: remove unuse buttonRef in ActionButton
2021-12-27 12:38:50 -06:00
David Lechner
9be6ba3640
update to Tooltip2
...
Tooltip has been deprecated so trying out the new Tooltip2.
2021-12-27 12:38:50 -06:00
David Lechner
db7f3be222
utils: convert ExternalLinkIcon to function
2021-12-27 12:38:50 -06:00
David Lechner
534d3f80e6
toolbar: convert Toolbar to function
2021-12-27 12:38:50 -06:00
David Lechner
8cd014c2ab
toolbar: convert OpenFileButton to function
2021-12-27 12:38:50 -06:00
David Lechner
f3e179683e
toolbar: convert ActionButton to function
2021-12-27 12:38:50 -06:00
David Lechner
4b19604fa9
terminal: convert Terminal to function component
2021-12-27 12:38:50 -06:00
David Lechner
5d201e61ae
status-bar: convert StatusBar to function
2021-12-27 12:38:50 -06:00