cleaned up settings file

This commit is contained in:
Adrian 2025-01-24 21:22:14 -06:00
parent afebc2dd1e
commit c6ba93c46f
1 changed files with 62 additions and 63 deletions

View File

@ -32,7 +32,7 @@ export function SettingsItem({
description, description,
children, children,
className, className,
}: { }: {
title: string; title: string;
description: string | React.ReactNode; description: string | React.ReactNode;
children?: React.ReactNode; children?: React.ReactNode;
@ -103,6 +103,12 @@ export default function SettingsSidebar() {
} | null>(null); } | null>(null);
const [usbEmulationEnabled, setUsbEmulationEnabled] = useState(false); const [usbEmulationEnabled, setUsbEmulationEnabled] = useState(false);
const getUsbEmulationState = useCallback(() => {
send("getUsbEmulationState", {}, resp => {
if ("error" in resp) return;
setUsbEmulationEnabled(resp.result as boolean);
});
}, [send]);
const [usbConfig, setUsbConfig] = useState({ const [usbConfig, setUsbConfig] = useState({
usb_product_id: '', usb_product_id: '',
@ -112,13 +118,6 @@ export default function SettingsSidebar() {
usb_name: '', usb_name: '',
}) })
const getUsbEmulationState = useCallback(() => {
send("getUsbEmulationState", {}, resp => {
if ("error" in resp) return;
setUsbEmulationEnabled(resp.result as boolean);
});
}, [send]);
const handleUsbEmulationToggle = useCallback( const handleUsbEmulationToggle = useCallback(
(enabled: boolean) => { (enabled: boolean) => {
send("setUsbEmulationState", { enabled: enabled }, resp => { send("setUsbEmulationState", { enabled: enabled }, resp => {