Browse Source

Merge branch 'implement-ui' into restore-docker-configuration

develop
Apostolos Fanakis 4 years ago
parent
commit
8d323b4c72
  1. 15
      packages/concordia-app/src/components/PostCreate/index.jsx
  2. 2
      packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

15
packages/concordia-app/src/components/PostCreate/index.jsx

@ -2,7 +2,7 @@ import React, {
memo, useCallback, useEffect, useState, memo, useCallback, useEffect, useState,
} from 'react'; } from 'react';
import { import {
Button, Feed, Form, Icon, Image, Input, TextArea, Button, Feed, Form, Icon, Image, TextArea,
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
@ -23,11 +23,10 @@ const { orbit } = breeze;
const PostCreate = (props) => { const PostCreate = (props) => {
const { const {
topicId, postIndexInTopic, initialPostSubject, account, topicId, initialPostSubject, account,
} = props; } = props;
const transactionStack = useSelector((state) => state.transactionStack); const transactionStack = useSelector((state) => state.transactionStack);
const transactions = useSelector((state) => state.transactions); const transactions = useSelector((state) => state.transactions);
const [postSubject] = useState(initialPostSubject);
const [postContent, setPostContent] = useState(''); const [postContent, setPostContent] = useState('');
const [userProfilePictureUrl, setUserProfilePictureUrl] = useState(); const [userProfilePictureUrl, setUserProfilePictureUrl] = useState();
const [createPostCacheSendStackId, setCreatePostCacheSendStackId] = 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, transactions,
]); ]);
const savePost = useCallback(() => { const savePost = useCallback(() => {
if (postSubject === '' || postContent === '') { if (postContent === '') {
return; return;
} }
setPosting(true); setPosting(true);
setCreatePostCacheSendStackId(createPost.cacheSend(...[topicId], { from: account })); setCreatePostCacheSendStackId(createPost.cacheSend(...[topicId], { from: account }));
}, [account, postContent, postSubject, topicId]); }, [account, postContent, topicId]);
return ( return (
<Feed> <Feed>
@ -159,7 +158,7 @@ const PostCreate = (props) => {
animated animated
type="button" type="button"
color="green" color="green"
disabled={posting || postSubject === '' || postContent === ''} disabled={posting || postContent === ''}
onClick={savePost} onClick={savePost}
> >
<Button.Content visible> <Button.Content visible>
@ -179,8 +178,6 @@ const PostCreate = (props) => {
PostCreate.propTypes = { PostCreate.propTypes = {
topicId: PropTypes.number.isRequired, topicId: PropTypes.number.isRequired,
postIndexInTopic: PropTypes.number.isRequired,
initialPostSubject: PropTypes.string.isRequired,
}; };
export default memo(PostCreate); export default memo(PostCreate);

2
packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

@ -141,7 +141,7 @@ const GeneralTab = (props) => {
</Table.Body> </Table.Body>
</Table> </Table>
), [ ), [
authorAvatar, numberOfPosts, numberOfTopics, profileAddress, profileMeta, userInfoOrbitAddress, authorAvatar, numberOfPosts, numberOfTopics, profileAddress, profileMeta, t, userInfoOrbitAddress,
userPostsOrbitAddress, userRegistrationTimestamp, userTopicsOrbitAddress, username, userPostsOrbitAddress, userRegistrationTimestamp, userTopicsOrbitAddress, username,
]); ]);
}; };

Loading…
Cancel
Save