perf: merge Translate Popup/Selected shortcut

This commit is contained in:
Gabe Yuan
2023-11-28 13:36:40 +08:00
parent 52ca4306fd
commit 7d3972d3a8
8 changed files with 21 additions and 106 deletions

View File

@@ -3,12 +3,7 @@ import Stack from "@mui/material/Stack";
import TextField from "@mui/material/TextField";
import MenuItem from "@mui/material/MenuItem";
import { useI18n } from "../../hooks/I18n";
import {
OPT_TRANS_ALL,
OPT_LANGS_FROM,
OPT_LANGS_TO,
DEFAULT_TRANSEL_SHORTCUT,
} from "../../config";
import { OPT_TRANS_ALL, OPT_LANGS_FROM, OPT_LANGS_TO } from "../../config";
import ShortcutInput from "./ShortcutInput";
import FormControlLabel from "@mui/material/FormControlLabel";
import Switch from "@mui/material/Switch";
@@ -44,20 +39,12 @@ export default function Tranbox() {
[updateTranbox]
);
const handleShortcutTransel = useCallback(
(val) => {
updateTranbox({ transelShortcut: val });
},
[updateTranbox]
);
const {
transOpen,
translator,
fromLang,
toLang,
tranboxShortcut,
transelShortcut = DEFAULT_TRANSEL_SHORTCUT,
btnOffsetX,
btnOffsetY,
hideTranBtn = false,
@@ -160,12 +147,6 @@ export default function Tranbox() {
onChange={handleShortcutInput}
label={i18n("trigger_tranbox_shortcut")}
/>
<ShortcutInput
value={transelShortcut}
onChange={handleShortcutTransel}
label={i18n("trigger_transel_shortcut")}
/>
</Stack>
</Box>
);