import { Button, Form, Input } from 'antd'; import { useIntl, useLocale } from 'dumi'; import React from 'react'; import { styled } from 'styled-components'; import { useSnapshot } from 'valtio'; import { feedbackStore, resetSectionFeedback } from '../../model/feedback'; import { useFeedbackService } from './service'; const StyledForm = styled(Form)` .ant-form-item:last-child { margin-bottom: 8px; } `; export const SectionFeedbackCommentForm: React.FC = () => { const { formatMessage } = useIntl(); const [form] = Form.useForm(); const feedbackState = useSnapshot(feedbackStore); const locale = useLocale(); const currentLocale = locale.id; const onCancel = () => { form.resetFields(); resetSectionFeedback(); }; const { submitFeedback, showFeedbackResult } = useFeedbackService(); const onFinish = (values) => { submitFeedback({ comment: values.comment, }) .then(() => { onCancel(); showFeedbackResult(true); }) .catch(() => { showFeedbackResult(false); }); }; const getCommentFieldLabel = () => { const leftQuote = currentLocale === 'zh' ? '「' : '"'; const rightQuote = currentLocale === 'zh' ? '」' : '"'; return (