Skip to content

Commit

Permalink
improve: generic-modal - update connect-modal
Browse files Browse the repository at this point in the history
  • Loading branch information
pongstr committed Dec 24, 2024
1 parent 7b379bc commit 993b59a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/ConnectModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import { UserCancelledError } from "@zmkfirmware/zmk-studio-ts-client/transport/
import type { AvailableDevice } from "./tauri/index";
import { Bluetooth, RefreshCw } from "lucide-react";
import { Key, ListBox, ListBoxItem, Selection } from "react-aria-components";
import { useModalRef } from "./misc/useModalRef";
import { ExternalLink } from "./misc/ExternalLink";
import { GenericModal } from "./GenericModal";
import { Modal, ModalContent } from "./modal/Modal";

export type TransportFactory = {
label: string;
Expand Down Expand Up @@ -278,16 +277,16 @@ export const ConnectModal = ({
transports,
onTransportCreated,
}: ConnectModalProps) => {
const dialog = useModalRef(open || false, false, false);

const haveTransports = useMemo(() => transports.length > 0, [transports]);

return (
<GenericModal ref={dialog} className="max-w-xl">
<h1 className="text-xl">Welcome to ZMK Studio</h1>
{haveTransports
? connectOptions(transports, onTransportCreated, open)
: noTransportsOptionsPrompt()}
</GenericModal>
<Modal open={open ?? true} onOpenChange={()=> {}} onEscapeClose={false} onBackdropClose={false}>
<ModalContent className="w-96" showCloseButton={false}>
<h1 className="text-xl">Welcome to ZMK Studio</h1>
{haveTransports
? connectOptions(transports, onTransportCreated, open)
: noTransportsOptionsPrompt()}
</ModalContent>
</Modal>
);
};

0 comments on commit 993b59a

Please sign in to comment.