import { Center, FormControl, FormHelperText, FormLabel, Icon, Input, Select, SelectContent, SelectIcon, SelectListbox, SelectOption, SelectOptionIndicator, SelectOptionText, SelectPlaceholder, SelectTrigger, SelectValue, Switch as HopeSwitch, Textarea, } from "@hope-ui/solid" import { For, Match, Show, Switch } from "solid-js" import { useT } from "~/hooks" import { Flag, SettingItem, Type } from "~/types" import { TiDelete } from "solid-icons/ti" // 角色数字到字符串的映射 const getRoleString = (value: string): string => { switch (value) { case "0": return "general" case "1": return "guest" case "2": return "admin" default: return value } } export type ItemProps = SettingItem & { onChange?: (value: string) => void onDelete?: () => void // value: () => string; hideLabel?: boolean w?: string } const Item = (props: ItemProps) => { const t = useT() return ( {t(`settings.${props.key}`)} { props.onDelete?.() }} /> {t("settings_other.unknown_type")}}> props.onChange?.(e.currentTarget.value)} readOnly={props.flag === Flag.READONLY} /> // props.onChange?.(props.value() === "true" ? "false" : "true") props.onChange?.(e.currentTarget.checked ? "true" : "false") } readOnly={props.flag === Flag.READONLY} />