import { useQuery } from "@tanstack/react-query"; import { ChevronDown, ChevronRight, InfoIcon } from "lucide-react"; import { useState } from "react"; import { Controller, type UseFormReturn } from "react-hook-form"; import { useTranslation } from "react-i18next"; import { Card, CardContent } from "@/components/ui/card"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Field, FieldLabel } from "@/components/ui/field"; import { Input } from "@/components/ui/input"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; import { TabsContent } from "@/components/ui/tabs"; import { Tooltip, TooltipContent, TooltipTrigger, } from "@/components/ui/tooltip"; import { env } from "@/config"; import type { MemShellFormSchema } from "@/types/schema"; import { OptionalClassFormField } from "./classname-field"; import { ShellTypeFormField } from "./shelltype-field"; import { UrlPatternFormField } from "./urlpattern-field"; export function CommandTabContent({ form, shellTypes, }: Readonly<{ form: UseFormReturn; shellTypes: Array; }>) { const { t } = useTranslation(["memshell", "common"]); const [isAdvancedOpen, setIsAdvancedOpen] = useState(false); const { data } = useQuery<{ encryptors: Array; implementationClasses: Array; }>({ queryKey: ["commandConfigs"], queryFn: async () => { const response = await fetch(`${env.API_URL}/api/config/command/configs`); return await response.json(); }, }); return (
(
{t("common:paramName")} {t("common:optional")}

{t("common:paramName.description")}

)} /> {isAdvancedOpen ? ( ) : ( )} {t("common:advancedConfig")}
( {t("common:encryptor")} )} /> ( {t("common:implementationClass")} )} />
( {t("common:commandTemplate")} {t("common:optional")}

{t("common:commandTemplate.description")}

)} />
); }