Skip to content

Commit

Permalink
feat: Add alert on connect failures, bump deps. (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson authored Oct 2, 2024
1 parent 8d14c5e commit 997edc9
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 45 deletions.
77 changes: 37 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"build-storybook": "storybook build"
},
"dependencies": {
"@tauri-apps/api": "^2.0.0-beta.16",
"@tauri-apps/plugin-cli": "^2.0.0-beta.8",
"@zmkfirmware/zmk-studio-ts-client": "^0.0.16",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-cli": "^2.0.0",
"@zmkfirmware/zmk-studio-ts-client": "^0.0.17",
"emittery": "^1.0.3",
"immer": "^10.1.1",
"lucide-react": "^0.445.0",
Expand Down
11 changes: 9 additions & 2 deletions src/ConnectModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useCallback, useEffect, useMemo, useState } from "react";

import type { RpcTransport } from "@zmkfirmware/zmk-studio-ts-client/transport/index";
import { UserCancelledError } from "@zmkfirmware/zmk-studio-ts-client/transport/errors";
import type { AvailableDevice } from "./tauri/index";
import { Bluetooth, RefreshCw } from "lucide-react";
import { Key, ListBox, ListBoxItem, Selection } from "react-aria-components";
Expand Down Expand Up @@ -92,7 +93,9 @@ function deviceList(
onClick={onRefresh}
>
<RefreshCw
className={`size-5 transition-transform ${refreshing ? "animate-spin" : ""}`}
className={`size-5 transition-transform ${
refreshing ? "animate-spin" : ""
}`}
/>
</button>
</div>
Expand Down Expand Up @@ -151,8 +154,12 @@ function simpleDevicePicker(
}
setSelectedTransport(undefined);
}
} catch {
} catch (e) {
if (!ignore) {
console.error(e);
if (e instanceof Error && !(e instanceof UserCancelledError)) {
alert(e.message);
}
setSelectedTransport(undefined);
}
}
Expand Down

0 comments on commit 997edc9

Please sign in to comment.