import {
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
} from "@/components/ui/form.tsx";
import { Input } from "@/components/ui/input.tsx";
import { Switch } from "@/components/ui/switch.tsx";
import { Button } from "@/components/ui/button.tsx";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select.tsx";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion.tsx";
import {
Popover,
PopoverContent,
PopoverTrigger,
} from "@/components/ui/popover.tsx";
import {
Command,
CommandEmpty,
CommandGroup,
CommandInput,
CommandItem,
} from "@/components/ui/command.tsx";
import { Slider } from "@/components/ui/slider.tsx";
import { PasswordInput } from "@/components/ui/password-input.tsx";
import { Check, ChevronsUpDown, Plus, X } from "lucide-react";
import { cn } from "@/lib/utils.ts";
import {
TERMINAL_THEMES,
TERMINAL_FONTS,
CURSOR_STYLES,
BELL_STYLES,
FAST_SCROLL_MODIFIERS,
} from "@/constants/terminal-themes.ts";
import { TerminalPreview } from "@/ui/desktop/apps/features/terminal/TerminalPreview.tsx";
import type { HostTerminalTabProps } from "./shared/tab-types";
import React from "react";
export function HostTerminalTab({ form, snippets, t }: HostTerminalTabProps) {
const [snippetPopoverOpen, setSnippetPopoverOpen] = React.useState(false);
return (
(
{t("hosts.enableTerminal")}
{t("hosts.enableTerminalDesc")}
)}
/>
{t("hosts.terminalCustomization")}
{t("hosts.appearance")}
(
{t("hosts.theme")}
{t("hosts.chooseColorTheme")}
)}
/>
(
{t("hosts.fontFamily")}
{t("hosts.selectFontDesc")}
)}
/>
(
{t("hosts.fontSizeValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.adjustFontSize")}
)}
/>
(
{t("hosts.letterSpacingValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.adjustLetterSpacing")}
)}
/>
(
{t("hosts.lineHeightValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.adjustLineHeight")}
)}
/>
(
{t("hosts.cursorStyle")}
{t("hosts.chooseCursorAppearance")}
)}
/>
(
{t("hosts.cursorBlink")}
{t("hosts.enableCursorBlink")}
)}
/>
{t("hosts.behavior")}
(
{t("hosts.scrollbackBufferValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.scrollbackBufferDesc")}
)}
/>
(
{t("hosts.bellStyle")}
{t("hosts.bellStyleDesc")}
)}
/>
(
{t("hosts.rightClickSelectsWord")}
{t("hosts.rightClickSelectsWordDesc")}
)}
/>
(
{t("hosts.fastScrollModifier")}
{t("hosts.fastScrollModifierDesc")}
)}
/>
(
{t("hosts.fastScrollSensitivityValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.fastScrollSensitivityDesc")}
)}
/>
(
{t("hosts.minimumContrastRatioValue", {
value: field.value,
})}
field.onChange(value)}
/>
{t("hosts.minimumContrastRatioDesc")}
)}
/>
{t("hosts.advanced")}
(
{t("hosts.sshAgentForwarding")}
{t("hosts.sshAgentForwardingDesc")}
)}
/>
(
{t("hosts.backspaceMode")}
{t("hosts.backspaceModeDesc")}
)}
/>
{
const open = snippetPopoverOpen;
const setOpen = setSnippetPopoverOpen;
const selectedSnippet = snippets.find(
(s) => s.id === field.value,
);
return (
{t("hosts.startupSnippet")}
{t("hosts.noSnippetFound")}
{
field.onChange(null);
setOpen(false);
}}
>
{t("hosts.snippetNone")}
{snippets.map((snippet) => (
{
field.onChange(snippet.id);
setOpen(false);
}}
>
{snippet.name}
{snippet.content}
))}
{t("hosts.executeSnippetOnConnect")}
);
}}
/>
(
{t("hosts.autoMosh")}
{t("hosts.autoMoshDesc")}
)}
/>
{form.watch("terminalConfig.autoMosh") && (
(
{t("hosts.moshCommand")}
{
field.onChange(e.target.value.trim());
field.onBlur();
}}
/>
{t("hosts.moshCommandDesc")}
)}
/>
)}
(
{t("hosts.sudoPasswordAutoFill")}
{t("hosts.sudoPasswordAutoFillDesc")}
)}
/>
{form.watch("terminalConfig.sudoPasswordAutoFill") && (
(
{t("hosts.sudoPassword")}
{t("hosts.sudoPasswordDesc")}
)}
/>
)}
);
}