gitscope
← marzneshin / v0.7.0 / dashboard/src/modules/hosts/dialogs/mutation/fields/mux-settings/protocol.tsx
https://dev.kronoz.win/r/marzneshin.git
dashboard/src/modules/hosts/dialogs/mutation/fields/mux-settings/protocol.tsx · TypeScript
Blame Raw
 1import {
 2    FormControl,
 3    FormField,
 4    FormItem,
 5    FormLabel,
 6    Select,
 7    SelectContent,
 8    SelectItem,
 9    SelectTrigger,
10    SelectValue,
11} from "@marzneshin/common/components";
12import { useTranslation } from "react-i18next";
13
14export const ProtocolField = ({
15    updater,
16}: {
17    updater: (field: string, value: any) => void;
18}) => {
19    const { t } = useTranslation();
20    return (
21        <FormField
22            name="mux_settings.protocol"
23            render={({ field }) => (
24                <FormItem>
25                    <FormLabel>{t("protocol")}</FormLabel>
26                    <Select
27                        onValueChange={(value) =>
28                            updater("mux_settings.protocol", value)
29                        }
30                        defaultValue={field.value ? field.value : "mux_cool"}
31                    >
32                        <FormControl>
33                            <SelectTrigger>
34                                <SelectValue placeholder="Select protocol" />
35                            </SelectTrigger>
36                        </FormControl>
37                        <SelectContent>
38                            <SelectItem value="mux_cool">Mux Cool</SelectItem>
39                            <SelectItem value="h2mux">h2mux</SelectItem>
40                            <SelectItem value="yamux">yamux</SelectItem>
41                            <SelectItem value="smux">smux</SelectItem>
42                        </SelectContent>
43                    </Select>
44                </FormItem>
45            )}
46        />
47    );
48};