diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml index 50734d4c..faa0cf7a 100644 --- a/i18n/en_US.yaml +++ b/i18n/en_US.yaml @@ -507,6 +507,7 @@ ui: search_tag: Search tag hint: "Describe what your question is about, at least one tag is required." no_result: No tags matched + tag_required_text: Required tag (at least one) header: nav: question: Questions diff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsx index ab028dac..3597a6a7 100644 --- a/ui/src/components/TagSelector/index.tsx +++ b/ui/src/components/TagSelector/index.tsx @@ -19,6 +19,7 @@ interface IProps { onBlur?: () => void; hiddenDescription?: boolean; hiddenCreateBtn?: boolean; + showRequiredTagText?: boolean; alwaysShowAddBtn?: boolean; } @@ -32,6 +33,7 @@ const TagSelector: FC = ({ hiddenDescription = false, hiddenCreateBtn = false, alwaysShowAddBtn = false, + showRequiredTagText = false, }) => { const [initialValue, setInitialValue] = useState([...value]); const [currentIndex, setCurrentIndex] = useState(0); @@ -224,14 +226,16 @@ const TagSelector: FC = ({ )} - {tags && tags.filter((v) => v.recommend)?.length > 0 && ( - - Required tag (at least one) - - )} + {showRequiredTagText && + tags && + tags.filter((v) => v.recommend)?.length > 0 && ( + + {t('tag_required_text')} + + )} {tags?.map((item, index) => { return ( diff --git a/ui/src/components/Unactivate/index.tsx b/ui/src/components/Unactivate/index.tsx index ebfbc777..e45eea5d 100644 --- a/ui/src/components/Unactivate/index.tsx +++ b/ui/src/components/Unactivate/index.tsx @@ -60,7 +60,7 @@ const Index: React.FC = ({ visible = false }) => { }) .catch((err) => { if (err.isError) { - const data = handleFormError(err.list, formData); + const data = handleFormError(err, formData); setFormData({ ...data }); } }) diff --git a/ui/src/pages/Admin/Branding/index.tsx b/ui/src/pages/Admin/Branding/index.tsx index 7d7c89ed..1b376525 100644 --- a/ui/src/pages/Admin/Branding/index.tsx +++ b/ui/src/pages/Admin/Branding/index.tsx @@ -115,7 +115,7 @@ const Index: FC = () => { }) .catch((err) => { if (err.isError) { - const data = handleFormError(err.list, formData); + const data = handleFormError(err, formData); setFormData({ ...data }); } }); diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsx index 7b5053f3..79614a49 100644 --- a/ui/src/pages/Questions/Ask/index.tsx +++ b/ui/src/pages/Questions/Ask/index.tsx @@ -348,6 +348,7 @@ const Ask = () => { {formData.tags.errorMsg} diff --git a/ui/src/pages/Users/Login/index.tsx b/ui/src/pages/Users/Login/index.tsx index b278b436..2f5b9180 100644 --- a/ui/src/pages/Users/Login/index.tsx +++ b/ui/src/pages/Users/Login/index.tsx @@ -130,9 +130,7 @@ const Index: React.FC = () => { // } // } if (err.isError) { - console.log('err===', err); const data = handleFormError(err, formData); - console.log('err===', data); if (err.list.filter((v) => v.error_field.indexOf('captcha') < 0)) { setModalState(false); }