Add TLS switch
This commit is contained in:
@@ -1,7 +1,14 @@
|
|||||||
import type React from "react";
|
import type React from "react";
|
||||||
|
|
||||||
import { Button, majorScale, Pane, TextInputField } from "evergreen-ui";
|
import {
|
||||||
import { useForm } from "react-hook-form";
|
Button,
|
||||||
|
FormField,
|
||||||
|
majorScale,
|
||||||
|
Pane,
|
||||||
|
Switch,
|
||||||
|
TextInputField,
|
||||||
|
} from "evergreen-ui";
|
||||||
|
import { Controller, useForm } from "react-hook-form";
|
||||||
import { FiPlusCircle } from "react-icons/fi";
|
import { FiPlusCircle } from "react-icons/fi";
|
||||||
|
|
||||||
import { useAppStore } from "@core/stores/appStore.js";
|
import { useAppStore } from "@core/stores/appStore.js";
|
||||||
@@ -17,12 +24,12 @@ export interface HTTPProps {
|
|||||||
export const HTTP = ({ close }: HTTPProps): JSX.Element => {
|
export const HTTP = ({ close }: HTTPProps): JSX.Element => {
|
||||||
const { addDevice } = useDeviceStore();
|
const { addDevice } = useDeviceStore();
|
||||||
const { setSelectedDevice } = useAppStore();
|
const { setSelectedDevice } = useAppStore();
|
||||||
const { register, handleSubmit } = useForm<{
|
const { register, handleSubmit, control } = useForm<{
|
||||||
ip: string;
|
ip: string;
|
||||||
tls: boolean;
|
tls: boolean;
|
||||||
}>({
|
}>({
|
||||||
defaultValues: {
|
defaultValues: {
|
||||||
ip: "meshtastic.local",
|
ip: "",
|
||||||
tls: false,
|
tls: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -52,7 +59,25 @@ export const HTTP = ({ close }: HTTPProps): JSX.Element => {
|
|||||||
padding={majorScale(2)}
|
padding={majorScale(2)}
|
||||||
gap={majorScale(2)}
|
gap={majorScale(2)}
|
||||||
>
|
>
|
||||||
<TextInputField label="IP Address/Hostname" {...register("ip")} />
|
<TextInputField
|
||||||
|
label="IP Address/Hostname"
|
||||||
|
placeholder="000.000.000.000 / meshtastic.local"
|
||||||
|
{...register("ip")}
|
||||||
|
/>
|
||||||
|
<FormField label="Use TLS">
|
||||||
|
<Controller
|
||||||
|
name="tls"
|
||||||
|
control={control}
|
||||||
|
render={({ field: { value, ...field } }) => (
|
||||||
|
<Switch
|
||||||
|
height={24}
|
||||||
|
marginLeft="auto"
|
||||||
|
checked={value}
|
||||||
|
{...field}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
</FormField>
|
||||||
<Button appearance="primary" gap={majorScale(1)} type="submit">
|
<Button appearance="primary" gap={majorScale(1)} type="submit">
|
||||||
Connect
|
Connect
|
||||||
<FiPlusCircle />
|
<FiPlusCircle />
|
||||||
|
|||||||
Reference in New Issue
Block a user