A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.
fix: only write or edit content show required tag text
shuai34f4c072ddb1
diff --git a/i18n/en_US.yaml b/i18n/en_US.yamlindex 50734d4c..faa0cf7a 100644--- a/i18n/en_US.yaml+++ b/i18n/en_US.yaml@@ -507,6 +507,7 @@ ui:search_tag: Search taghint: "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: Questionsdiff --git a/ui/src/components/TagSelector/index.tsx b/ui/src/components/TagSelector/index.tsxindex 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<IProps> = ({hiddenDescription = false,hiddenCreateBtn = false,alwaysShowAddBtn = false,+ showRequiredTagText = false,}) => {const [initialValue, setInitialValue] = useState<Type.Tag[]>([...value]);const [currentIndex, setCurrentIndex] = useState<number>(0);@@ -224,14 +226,16 @@ const TagSelector: FC<IProps> = ({</Form></Dropdown.Header>)}- {tags && tags.filter((v) => v.recommend)?.length > 0 && (- <Dropdown.Item- disabled- style={{ fontWeight: 500 }}- className="text-secondary">- Required tag (at least one)- </Dropdown.Item>- )}+ {showRequiredTagText &&+ tags &&+ tags.filter((v) => v.recommend)?.length > 0 && (+ <Dropdown.Item+ disabled+ style={{ fontWeight: 500 }}+ className="text-secondary">+ {t('tag_required_text')}+ </Dropdown.Item>+ )}{tags?.map((item, index) => {return (diff --git a/ui/src/pages/Questions/Ask/index.tsx b/ui/src/pages/Questions/Ask/index.tsxindex 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 = () => {<TagSelectorvalue={formData.tags.value}onChange={handleTagsChange}+ showRequiredTagText/><Form.Control.Feedback type="invalid">{formData.tags.errorMsg}