Skip to content

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: create tag error message prompt optimization

shuai2076dcd0e5c4
diff --git a/i18n/en_US.yaml b/i18n/en_US.yaml
index ee8d7088..7c9e6642 100644
--- a/i18n/en_US.yaml
+++ b/i18n/en_US.yaml
@@ -903,6 +903,7 @@ ui:
Views: Viewed
Follow: Follow
Following: Following
+ follow_tip: Follow this question to receive notifications.
answered: answered
closed_in: Closed in
show_exist: Show existing question.
diff --git a/ui/src/pages/Tags/Create/index.tsx b/ui/src/pages/Tags/Create/index.tsx
index bf9d07a5..1b78e562 100644
--- a/ui/src/pages/Tags/Create/index.tsx
+++ b/ui/src/pages/Tags/Create/index.tsx
@@ -79,10 +79,32 @@ const Index = () => {
formData.description.value,
]);
+ useEffect(() => {
+ return () => {
+ setFormData({
+ displayName: {
+ value: '',
+ isInvalid: false,
+ errorMsg: '',
+ },
+ slugName: {
+ value: '',
+ isInvalid: false,
+ errorMsg: '',
+ },
+ description: {
+ value: '',
+ isInvalid: false,
+ errorMsg: '',
+ },
+ });
+ };
+ }, []);
+
const handleDescriptionChange = (value: string) =>
setFormData({
...formData,
- description: { ...formData.description, value },
+ description: { ...formData.description, value, isInvalid: false },
});
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => {
@@ -115,20 +137,29 @@ const Index = () => {
const handleDisplayNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFormData({
...formData,
- displayName: { ...formData.displayName, value: e.currentTarget.value },
+ displayName: {
+ ...formData.displayName,
+ value: e.currentTarget.value,
+ isInvalid: false,
+ },
});
};
const handleSlugNameChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setFormData({
...formData,
- slugName: { ...formData.slugName, value: e.currentTarget.value },
+ slugName: {
+ ...formData.slugName,
+ value: e.currentTarget.value,
+ isInvalid: false,
+ },
});
};
usePageTags({
title: t('create_tag', { keyPrefix: 'page_title' }),
});
+
return (
<Container className="pt-4 mt-2 mb-5 edit-answer-wrap">
<Row className="justify-content-center">