|
@ -23,8 +23,6 @@ const TopicCreate = (props) => { |
|
|
const transactions = useSelector((state) => state.transactions); |
|
|
const transactions = useSelector((state) => state.transactions); |
|
|
const [subjectInput, setSubjectInput] = useState(''); |
|
|
const [subjectInput, setSubjectInput] = useState(''); |
|
|
const [contentInput, setContentInput] = useState(''); |
|
|
const [contentInput, setContentInput] = useState(''); |
|
|
const [topicSubjectInputEmptySubmit, setTopicSubjectInputEmptySubmit] = useState(false); |
|
|
|
|
|
const [topicMessageInputEmptySubmit, setTopicMessageInputEmptySubmit] = useState(false); |
|
|
|
|
|
const [createTopicCacheSendStackId, setCreateTopicCacheSendStackId] = useState(''); |
|
|
const [createTopicCacheSendStackId, setCreateTopicCacheSendStackId] = useState(''); |
|
|
const [posting, setPosting] = useState(false); |
|
|
const [posting, setPosting] = useState(false); |
|
|
|
|
|
|
|
@ -88,13 +86,7 @@ const TopicCreate = (props) => { |
|
|
}, [createTopicCacheSendStackId, history, contentInput, posting, subjectInput, transactionStack, transactions]); |
|
|
}, [createTopicCacheSendStackId, history, contentInput, posting, subjectInput, transactionStack, transactions]); |
|
|
|
|
|
|
|
|
const validateAndPost = useCallback(() => { |
|
|
const validateAndPost = useCallback(() => { |
|
|
if (subjectInput === '') { |
|
|
if (subjectInput === '' || contentInput === '') { |
|
|
setTopicSubjectInputEmptySubmit(true); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (contentInput === '') { |
|
|
|
|
|
setTopicMessageInputEmptySubmit(true); |
|
|
|
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -114,7 +106,6 @@ const TopicCreate = (props) => { |
|
|
placeholder={t('topic.create.form.subject.field.placeholder')} |
|
|
placeholder={t('topic.create.form.subject.field.placeholder')} |
|
|
name="subjectInput" |
|
|
name="subjectInput" |
|
|
className="form-input" |
|
|
className="form-input" |
|
|
error={topicSubjectInputEmptySubmit} |
|
|
|
|
|
value={subjectInput} |
|
|
value={subjectInput} |
|
|
onChange={handleSubjectInputChange} |
|
|
onChange={handleSubjectInputChange} |
|
|
/> |
|
|
/> |
|
@ -126,9 +117,6 @@ const TopicCreate = (props) => { |
|
|
<TextArea |
|
|
<TextArea |
|
|
id="form-topic-create-field-message" |
|
|
id="form-topic-create-field-message" |
|
|
name="contentInput" |
|
|
name="contentInput" |
|
|
className={topicMessageInputEmptySubmit |
|
|
|
|
|
? 'form-textarea-required' |
|
|
|
|
|
: ''} |
|
|
|
|
|
value={contentInput} |
|
|
value={contentInput} |
|
|
placeholder={t('topic.create.form.content.field.placeholder')} |
|
|
placeholder={t('topic.create.form.content.field.placeholder')} |
|
|
rows={5} |
|
|
rows={5} |
|
@ -142,7 +130,7 @@ const TopicCreate = (props) => { |
|
|
key="form-topic-create-button-submit" |
|
|
key="form-topic-create-button-submit" |
|
|
type="button" |
|
|
type="button" |
|
|
color="green" |
|
|
color="green" |
|
|
disabled={posting} |
|
|
disabled={posting || subjectInput === '' || contentInput === ''} |
|
|
onClick={validateAndPost} |
|
|
onClick={validateAndPost} |
|
|
> |
|
|
> |
|
|
<Button.Content visible> |
|
|
<Button.Content visible> |
|
|