import { useTranslation } from "react-i18next"; import { Input } from "@/components/input"; import { PasswordInput } from "@/components/password-input"; import { FakeSwitch, SectionCard, SettingRow } from "@/components/section-card"; import type { Host } from "@/types/ui-types"; import { Activity, Copy, Globe, Monitor, Network, Server, Settings, Shield, Terminal, Zap, } from "lucide-react"; import type { HostEditorForm } from "./HostEditorData"; type HostEditorSetField = ( key: K, value: HostEditorForm[K], ) => void; type GuacFieldSetter = (key: string, value: unknown) => void; function DocsLinkAction({ href, label }: { href: string; label: string }) { return ( {label} ); } export function HostEditorRdpTab({ form, setField, setGuacField, host, }: { form: HostEditorForm; setField: HostEditorSetField; setGuacField: GuacFieldSetter; host?: Host | null; }) { const { t } = useTranslation(); return ( <> } action={ } >
setField("rdpPort", Number(e.target.value))} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
} >
setField("rdpUser", e.target.value)} />
setField("rdpPassword", e.target.value)} />
setField("domain", e.target.value)} />
} >
setField("ignoreCert", v)} />
} >
setGuacField("width", e.target.value)} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
setGuacField("height", e.target.value)} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
setGuacField("dpi", e.target.value)} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
setGuacField("force-lossless", v)} />
} >
setGuacField("disable-audio", v)} /> setGuacField("enable-audio-input", v)} />
} >
setGuacField("enable-wallpaper", v)} /> setGuacField("enable-theming", v)} /> setGuacField("enable-font-smoothing", v)} /> setGuacField("enable-full-window-drag", v)} /> setGuacField("enable-desktop-composition", v)} /> setGuacField("enable-menu-animations", v)} /> setGuacField("disable-bitmap-caching", v)} /> setGuacField("disable-offscreen-caching", v)} /> setGuacField("disable-glyph-caching", v)} /> setGuacField("enable-gfx", v)} />
} >
setGuacField("enable-printing", v)} /> setGuacField("enable-drive", v)} />
setGuacField("drive-name", e.target.value)} />
setGuacField("drive-path", e.target.value)} />
setGuacField("create-drive-path", v)} /> setGuacField("disable-download", v)} /> setGuacField("disable-upload", v)} /> setGuacField("enable-touch", v)} />
} >
setGuacField("client-name", e.target.value)} />
setGuacField("console", v)} />
setGuacField("initial-program", e.target.value)} />
setGuacField("timezone", e.target.value)} />
} >
setGuacField("gateway-hostname", e.target.value) } />
setGuacField("gateway-port", e.target.value)} />
setGuacField("gateway-username", e.target.value) } />
setGuacField("gateway-password", e.target.value) } />
setGuacField("gateway-domain", e.target.value)} />
} >
setGuacField("remote-app", e.target.value)} />
setGuacField("remote-app-dir", e.target.value)} />
setGuacField("remote-app-args", e.target.value)} />
} >
setGuacField("disable-copy", v)} /> setGuacField("disable-paste", v)} />
} action={ } >
setGuacField("recording-path", e.target.value)} />
setGuacField("recording-name", e.target.value)} />
setGuacField("create-recording-path", v)} /> setGuacField("recording-exclude-output", v)} /> setGuacField("recording-exclude-mouse", v)} /> setGuacField("recording-include-keys", v)} />
} action={ } >
setGuacField("wol-send-packet", v)} />
setGuacField("wol-mac-addr", e.target.value)} />
setGuacField("wol-broadcast-addr", e.target.value) } />
setGuacField("wol-udp-port", e.target.value)} />
setGuacField("wol-wait-time", e.target.value)} />
); } export function HostEditorVncTab({ form, setField, setGuacField, host, }: { form: HostEditorForm; setField: HostEditorSetField; setGuacField: GuacFieldSetter; host?: Host | null; }) { const { t } = useTranslation(); return ( <> } action={ } >
setField("vncPort", Number(e.target.value))} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
} >
setField("vncPassword", e.target.value)} />
setField("vncUser", e.target.value)} />
} >
setGuacField("width", e.target.value)} />
setGuacField("height", e.target.value)} />
setGuacField("force-lossless", v)} />
} >
setGuacField("disable-audio", v)} />
} >
setGuacField("swap-red-blue", v)} /> setGuacField("read-only", v)} />
} >
setGuacField("disable-copy", v)} /> setGuacField("disable-paste", v)} />
} action={ } >
setGuacField("recording-path", e.target.value)} />
setGuacField("recording-name", e.target.value)} />
setGuacField("create-recording-path", v)} /> setGuacField("recording-exclude-output", v)} /> setGuacField("recording-exclude-mouse", v)} /> setGuacField("recording-include-keys", v)} />
} action={ } >
setGuacField("wol-send-packet", v)} />
setGuacField("wol-mac-addr", e.target.value)} />
setGuacField("wol-broadcast-addr", e.target.value) } />
setGuacField("wol-udp-port", e.target.value)} />
setGuacField("wol-wait-time", e.target.value)} />
); } export function HostEditorTelnetTab({ form, setField, setGuacField, }: { form: HostEditorForm; setField: HostEditorSetField; setGuacField: GuacFieldSetter; host?: Host | null; }) { const { t } = useTranslation(); return ( <> } action={ } >
setField("telnetPort", Number(e.target.value))} className="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none" />
} >
setField("telnetUser", e.target.value)} />
setField("telnetPassword", e.target.value)} />
} >
setGuacField("width", e.target.value)} />
setGuacField("height", e.target.value)} />
} >
setGuacField("font-name", e.target.value)} />
setGuacField("font-size", Number(e.target.value)) } />
} action={ } >
setGuacField("recording-path", e.target.value)} />
setGuacField("recording-name", e.target.value)} />
setGuacField("create-recording-path", v)} /> setGuacField("recording-exclude-output", v)} /> setGuacField("recording-include-keys", v)} />
); }