From 70eecae8026cbb45dcf74c3cf7f1286eb07b937d Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sat, 5 Dec 2020 21:46:25 +0200 Subject: [PATCH 1/2] Remove unused state --- .../src/components/PostCreate/index.jsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/concordia-app/src/components/PostCreate/index.jsx b/packages/concordia-app/src/components/PostCreate/index.jsx index b6322ea..a5508e0 100644 --- a/packages/concordia-app/src/components/PostCreate/index.jsx +++ b/packages/concordia-app/src/components/PostCreate/index.jsx @@ -23,11 +23,10 @@ const { orbit } = breeze; const PostCreate = (props) => { const { - topicId, postIndexInTopic, initialPostSubject, account, + topicId, initialPostSubject, account, } = props; const transactionStack = useSelector((state) => state.transactionStack); const transactions = useSelector((state) => state.transactions); - const [postSubject] = useState(initialPostSubject); const [postContent, setPostContent] = useState(''); const [userProfilePictureUrl, setUserProfilePictureUrl] = useState(); const [createPostCacheSendStackId, setCreatePostCacheSendStackId] = useState(''); @@ -107,18 +106,18 @@ const PostCreate = (props) => { } } }, [ - createPostCacheSendStackId, initialPostSubject, postContent, postSubject, posting, storingPost, transactionStack, + createPostCacheSendStackId, initialPostSubject, postContent, posting, storingPost, transactionStack, transactions, ]); const savePost = useCallback(() => { - if (postSubject === '' || postContent === '') { + if (postContent === '') { return; } setPosting(true); setCreatePostCacheSendStackId(createPost.cacheSend(...[topicId], { from: account })); - }, [account, postContent, postSubject, topicId]); + }, [account, postContent, topicId]); return ( @@ -159,7 +158,7 @@ const PostCreate = (props) => { animated type="button" color="green" - disabled={posting || postSubject === '' || postContent === ''} + disabled={posting || postContent === ''} onClick={savePost} > @@ -179,8 +178,6 @@ const PostCreate = (props) => { PostCreate.propTypes = { topicId: PropTypes.number.isRequired, - postIndexInTopic: PropTypes.number.isRequired, - initialPostSubject: PropTypes.string.isRequired, }; export default memo(PostCreate); From e9e4b3c392b51be1ab8f39909672b1a07d394baa Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sat, 5 Dec 2020 21:49:06 +0200 Subject: [PATCH 2/2] Fix lint issues --- packages/concordia-app/src/components/PostCreate/index.jsx | 2 +- packages/concordia-app/src/views/Profile/GeneralTab/index.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/concordia-app/src/components/PostCreate/index.jsx b/packages/concordia-app/src/components/PostCreate/index.jsx index a5508e0..76bb067 100644 --- a/packages/concordia-app/src/components/PostCreate/index.jsx +++ b/packages/concordia-app/src/components/PostCreate/index.jsx @@ -2,7 +2,7 @@ import React, { memo, useCallback, useEffect, useState, } from 'react'; import { - Button, Feed, Form, Icon, Image, Input, TextArea, + Button, Feed, Form, Icon, Image, TextArea, } from 'semantic-ui-react'; import PropTypes from 'prop-types'; import { useTranslation } from 'react-i18next'; diff --git a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx index 0b1193b..f98c050 100644 --- a/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx +++ b/packages/concordia-app/src/views/Profile/GeneralTab/index.jsx @@ -141,7 +141,7 @@ const GeneralTab = (props) => { ), [ - authorAvatar, numberOfPosts, numberOfTopics, profileAddress, profileMeta, userInfoOrbitAddress, + authorAvatar, numberOfPosts, numberOfTopics, profileAddress, profileMeta, t, userInfoOrbitAddress, userPostsOrbitAddress, userRegistrationTimestamp, userTopicsOrbitAddress, username, ]); };