From 78c32d51db1df7bb35d3f58569411583be2bd52f Mon Sep 17 00:00:00 2001 From: dongchengjie <37543964+dongchengjie@users.noreply.github.com> Date: Sun, 7 Jul 2024 21:56:20 +0800 Subject: [PATCH] chore: group types locale --- src/components/base/base-search-box.tsx | 2 +- .../profile/groups-editor-viewer.tsx | 73 ++++++++++++------- .../profile/proxies-editor-viewer.tsx | 5 +- src/components/profile/proxy-item.tsx | 1 + src/components/profile/rule-item.tsx | 1 + .../profile/rules-editor-viewer.tsx | 5 +- src/locales/en.json | 12 ++- src/locales/fa.json | 12 ++- src/locales/ru.json | 12 ++- src/locales/zh.json | 16 +++- 10 files changed, 94 insertions(+), 45 deletions(-) diff --git a/src/components/base/base-search-box.tsx b/src/components/base/base-search-box.tsx index 91488e0..eb50a46 100644 --- a/src/components/base/base-search-box.tsx +++ b/src/components/base/base-search-box.tsx @@ -26,7 +26,7 @@ type SearchProps = { export const BaseSearchBox = styled((props: SearchProps) => { const { t } = useTranslation(); const inputRef = useRef(null); - const [matchCase, setMatchCase] = useState(props.matchCase ?? true); + const [matchCase, setMatchCase] = useState(props.matchCase ?? false); const [matchWholeWord, setMatchWholeWord] = useState( props.matchWholeWord ?? false ); diff --git a/src/components/profile/groups-editor-viewer.tsx b/src/components/profile/groups-editor-viewer.tsx index c031ba5..fc8a832 100644 --- a/src/components/profile/groups-editor-viewer.tsx +++ b/src/components/profile/groups-editor-viewer.tsx @@ -23,6 +23,7 @@ import { DialogActions, DialogContent, DialogTitle, + InputAdornment, List, ListItem, ListItemText, @@ -273,7 +274,7 @@ export const GroupsEditorViewer = (props: Props) => { const validateGroup = () => { let group = formIns.getValues(); if (group.name === "") { - throw new Error(t("Group Name Cannot Be Empty")); + throw new Error(t("Group Name Required")); } }; @@ -342,6 +343,11 @@ export const GroupsEditorViewer = (props: Props) => { "relay", ]} value={field.value} + renderOption={(props, option) => ( +
  • + {option} +
  • + )} onChange={(_, value) => value && field.onChange(value)} renderInput={(params) => } /> @@ -370,7 +376,7 @@ export const GroupsEditorViewer = (props: Props) => { control={control} render={({ field }) => ( - + { )} /> - { { )} /> + ( + + + { + field.onChange(parseInt(e.target.value)); + }} + /> + + )} + /> { { field.onChange(parseInt(e.target.value)); }} + InputProps={{ + endAdornment: ( + + {t("seconds")} + + ), + }} /> )} @@ -460,12 +492,20 @@ export const GroupsEditorViewer = (props: Props) => { { field.onChange(parseInt(e.target.value)); }} + InputProps={{ + endAdornment: ( + + {t("millis")} + + ), + }} /> )} @@ -478,6 +518,7 @@ export const GroupsEditorViewer = (props: Props) => { { )} /> - ( - - - { - field.onChange(parseInt(e.target.value)); - }} - /> - - )} - /> { onClick={() => { try { validateGroup(); - for (const item of prependSeq) { + for (const item of [...prependSeq, ...groupList]) { if (item.name === formIns.getValues().name) { throw new Error(t("Group Name Already Exists")); } @@ -705,7 +729,7 @@ export const GroupsEditorViewer = (props: Props) => { onClick={() => { try { validateGroup(); - for (const item of appendSeq) { + for (const item of [...appendSeq, ...groupList]) { if (item.name === formIns.getValues().name) { throw new Error(t("Group Name Already Exists")); } @@ -727,10 +751,7 @@ export const GroupsEditorViewer = (props: Props) => { padding: "0 10px", }} > - setMatch(() => match)} - /> + setMatch(() => match)} /> { padding: "0 10px", }} > - setMatch(() => match)} - /> + setMatch(() => match)} /> { sx={{ cursor: sortable ? "move" : "" }} primary={ {proxy.name} diff --git a/src/components/profile/rule-item.tsx b/src/components/profile/rule-item.tsx index dfff9ef..2877e49 100644 --- a/src/components/profile/rule-item.tsx +++ b/src/components/profile/rule-item.tsx @@ -59,6 +59,7 @@ export const RuleItem = (props: Props) => { sx={{ cursor: sortable ? "move" : "" }} primary={ {ruleContent || "-"} diff --git a/src/components/profile/rules-editor-viewer.tsx b/src/components/profile/rules-editor-viewer.tsx index 5aac7ca..9cd51f2 100644 --- a/src/components/profile/rules-editor-viewer.tsx +++ b/src/components/profile/rules-editor-viewer.tsx @@ -573,10 +573,7 @@ export const RulesEditorViewer = (props: Props) => { padding: "0 10px", }} > - setMatch(() => match)} - /> + setMatch(() => match)} />