)}
@@ -72,4 +89,4 @@ const Form = ({
);
};
-export default memo(Form);
+export default memo(Index);
diff --git a/ui/src/components/Comment/components/Reply/index.tsx b/ui/src/components/Comment/components/Reply/index.tsx
index 01c9399c..3048c3a4 100644
--- a/ui/src/components/Comment/components/Reply/index.tsx
+++ b/ui/src/components/Comment/components/Reply/index.tsx
@@ -1,21 +1,30 @@
import { useState, memo } from 'react';
-import { Button } from 'react-bootstrap';
+import { Button, Form } from 'react-bootstrap';
import { useTranslation } from 'react-i18next';
+import classNames from 'classnames';
+
import { TextArea, Mentions } from '@/components';
import { usePageUsers } from '@/hooks';
-const Form = ({ userName, onSendReply, onCancel, mode }) => {
+const Index = ({ userName, onSendReply, onCancel, mode }) => {
const [value, setValue] = useState('');
const pageUsers = usePageUsers();
const { t } = useTranslation('translation', { keyPrefix: 'comment' });
-
+ const [validationErrorMsg, setValidationErrorMsg] = useState('');
const handleChange = (e) => {
setValue(e.target.value);
};
const handleSelected = (val) => {
setValue(val);
};
+ const handleSendReply = () => {
+ onSendReply(value).catch((ex) => {
+ if (ex.isError) {
+ setValidationErrorMsg(ex.msg);
+ }
+ });
+ };
return (
@@ -24,18 +33,26 @@ const Form = ({ userName, onSendReply, onCancel, mode }) => {
-
-
-
-
{t(`tip_${mode}`)}
+
+
+
+
+
{t(`tip_${mode}`)}
+
+
+ {validationErrorMsg}
+