import Box from "@mui/material/Box"; import Stack from "@mui/material/Stack"; import TextField from "@mui/material/TextField"; import { GLOBAL_KEY, REMAIN_KEY, OPT_LANGS_FROM, OPT_LANGS_TO, OPT_STYLE_ALL, OPT_STYLE_DIY, OPT_STYLE_USE_COLOR, } from "../../config"; import { useI18n } from "../../hooks/I18n"; import MenuItem from "@mui/material/MenuItem"; import Grid from "@mui/material/Grid"; import { useOwSubRule } from "../../hooks/SubRules"; import { useApiList } from "../../hooks/Api"; export default function OwSubRule() { const i18n = useI18n(); const { owSubrule, updateOwSubrule } = useOwSubRule(); const { enabledApis } = useApiList(); const handleChange = (e) => { e.preventDefault(); const { name, value } = e.target; updateOwSubrule({ [name]: value }); }; const { apiSlug, fromLang, toLang, textStyle, transOpen, bgColor, textDiyStyle, } = owSubrule; const RemainItem = ( {i18n("remain_unchanged")} ); const GlobalItem = ( {GLOBAL_KEY} ); return ( {RemainItem} {GlobalItem} {i18n("default_enabled")} {i18n("default_disabled")} {RemainItem} {GlobalItem} {enabledApis.map((api) => ( {api.apiName} ))} {RemainItem} {GlobalItem} {OPT_LANGS_FROM.map(([lang, name]) => ( {name} ))} {RemainItem} {GlobalItem} {OPT_LANGS_TO.map(([lang, name]) => ( {name} ))} {RemainItem} {GlobalItem} {OPT_STYLE_ALL.map((item) => ( {i18n(item)} ))} {OPT_STYLE_USE_COLOR.includes(textStyle) && ( )} {textStyle === OPT_STYLE_DIY && ( )} ); }