Disable Connect/Disconnect buttons when not in use

This commit is contained in:
GHOSCHT 2022-04-04 19:25:16 +02:00
parent efd71d6989
commit 19d4d2c426
No known key found for this signature in database
GPG key ID: A35BD466B8871994

View file

@ -1,7 +1,7 @@
import electron from "electron";
import React, { useState } from "react";
import { Dialog, DialogType, DialogFooter } from "@fluentui/react/lib/Dialog";
import { PrimaryButton, DefaultButton } from "@fluentui/react/lib/Button";
import { DefaultButton } from "@fluentui/react/lib/Button";
import { ThemeProvider, PartialTheme } from "@fluentui/react/lib/Theme";
import { ComboBox, IComboBoxOption } from "@fluentui/react/lib/ComboBox";
import SerialPort from "serialport";
@ -92,8 +92,8 @@ const Settings: React.FC<Proptypes> = () => {
/>
<DialogFooter>
<PrimaryButton onClick={() => { dispatch(connect()); }} text="Connect" />
<DefaultButton onClick={() => { dispatch(disconnect()); }} text="Disconnect" />
<DefaultButton primary disabled={selector.serialConnection.status.connected} onClick={() => { dispatch(connect()); }} text="Connect" />
<DefaultButton disabled={!selector.serialConnection.status.connected} onClick={() => { dispatch(disconnect()); }} text="Disconnect" />
</DialogFooter>
</Dialog>
</ThemeProvider>