Browse Source

refactor: resolve lint warnings

develop
Apostolos Fanakis 4 years ago
parent
commit
12b6b1adce
Signed by: Apostolof GPG Key ID: 8600B4C4163B3269
  1. 4
      packages/concordia-app/src/components/PostList/PostListRow/index.jsx
  2. 25
      packages/concordia-app/src/components/PostList/PostVoting/index.jsx
  3. 9
      packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
  4. 10
      packages/concordia-app/src/components/UsernameSelector.jsx
  5. 6
      packages/concordia-app/src/views/Profile/GeneralTab/index.jsx
  6. 6
      packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx
  7. 6
      packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx
  8. 6
      packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx

4
packages/concordia-app/src/components/PostList/PostListRow/index.jsx

@ -23,7 +23,9 @@ import './styles.css';
const { orbit } = breeze;
const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { clearCacheCall: clearGetPostChainData } } } } } = drizzle;
const {
contracts: { [FORUM_CONTRACT]: { methods: { getPost: { clearCacheCall: clearGetPostChainData } } } },
} = drizzle;
const PostListRow = (props) => {
const {

25
packages/concordia-app/src/components/PostList/PostVoting/index.jsx

@ -32,7 +32,8 @@ const PostVoting = (props) => {
// Current votes
const [getVoteInfoCallHash, setGetVoteInfoCallHash] = useState(null);
const getVoteInfoResult = useSelector((state) => state.contracts[POST_VOTING_CONTRACT].getVoteInfo[getVoteInfoCallHash]);
const getVoteInfoResult = useSelector((state) => state.contracts[POST_VOTING_CONTRACT]
.getVoteInfo[getVoteInfoCallHash]);
const [ownVote, setOwnVote] = useState(null);
const [totalVoteCount, setTotalVoteCount] = useState(null);
@ -77,13 +78,22 @@ const PostVoting = (props) => {
if (voting) return;
setVoting(true);
if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_DOWN) && choice === CHOICE_UP) setVoteCacheSendStackId(upvote.cacheSend(postId, { from: userAccount }));
else if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_UP) && choice === CHOICE_DOWN) setVoteCacheSendStackId(downvote.cacheSend(postId, { from: userAccount }));
else if ((ownVote === CHOICE_UP && choice === CHOICE_UP) || (ownVote === CHOICE_DOWN && choice === CHOICE_DOWN)) setVoteCacheSendStackId(unvote.cacheSend(postId, { from: userAccount }));
else setVoting(false);
if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_DOWN) && choice === CHOICE_UP) {
setVoteCacheSendStackId(upvote.cacheSend(postId, { from: userAccount }));
} else if ((ownVote === CHOICE_DEFAULT || ownVote === CHOICE_UP) && choice === CHOICE_DOWN) {
setVoteCacheSendStackId(downvote.cacheSend(postId, { from: userAccount }));
} else if ((ownVote === CHOICE_UP && choice === CHOICE_UP) || (ownVote === CHOICE_DOWN && choice === CHOICE_DOWN)) {
setVoteCacheSendStackId(unvote.cacheSend(postId, { from: userAccount }));
} else {
setVoting(false);
}
}, [ownVote, postId, userAccount, voting]);
const disableVoting = userAccount === null || !hasSignedUp || postAuthorAddress === null || userAccount === postAuthorAddress;
const disableVoting = userAccount === null
|| !hasSignedUp
|| postAuthorAddress === null
|| userAccount === postAuthorAddress;
// Clear when unmounting
useEffect(() => () => clearGetVoteInfoChainData(postId), [postId]);
@ -107,7 +117,8 @@ const PostVoting = (props) => {
  
</span>
)}
disabled={(upvoteCount === null && downvoteCount === null) || (upvoteCount === '0' && downvoteCount === '0')}
disabled={(upvoteCount === null && downvoteCount === null)
|| (upvoteCount === '0' && downvoteCount === '0')}
position="bottom center"
>
{upvoteCount !== '0' ? (

9
packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx

@ -23,7 +23,9 @@ import targetBlank from '../../../utils/markdownUtils';
const { orbit } = breeze;
const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { clearCacheCall: clearGetTopicChainData } } } } } = drizzle;
const {
contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { clearCacheCall: clearGetTopicChainData } } } },
} = drizzle;
const TopicListRow = (props) => {
const { id: topicId, topicCallHash, loading } = props;
@ -177,7 +179,10 @@ const TopicListRow = (props) => {
</Segment>
</Dimmer.Dimmable>
);
}, [history, loading, numberOfReplies, t, timeAgo, topicAuthor, topicAuthorAddress, topicAuthorMeta, topicId, topicSubject]);
}, [
history, loading, numberOfReplies, t, timeAgo, topicAuthor, topicAuthorAddress, topicAuthorMeta, topicId,
topicSubject,
]);
};
TopicListRow.defaultProps = {

10
packages/concordia-app/src/components/UsernameSelector.jsx

@ -9,7 +9,15 @@ import PropTypes from 'prop-types';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { drizzle } from '../redux/store';
const { contracts: { [FORUM_CONTRACT]: { methods: { isUserNameTaken: { cacheCall: isUserNameTakenChainData, clearCacheCall: clearIsUserNameTakenChainData } } } } } = drizzle;
const {
contracts: {
[FORUM_CONTRACT]: {
methods: {
isUserNameTaken: { cacheCall: isUserNameTakenChainData, clearCacheCall: clearIsUserNameTakenChainData },
},
},
},
} = drizzle;
const UsernameSelector = (props) => {
const {

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

@ -200,7 +200,11 @@ const GeneralTab = (props) => {
</Table>
{isSelf && editInformationModal}
</>
), [editInformationModal, isSelf, numberOfPosts, numberOfTopics, profileAddress, profileMetadataFetched, t, userAvatarUrl, userInfoOrbitAddress, userLocationCell, userPollsOrbitAddress, userPostsOrbitAddress, userRegistrationTimestamp, userTopicsOrbitAddress, username]);
), [
editInformationModal, isSelf, numberOfPosts, numberOfTopics, profileAddress, profileMetadataFetched, t,
userAvatarUrl, userInfoOrbitAddress, userLocationCell, userPollsOrbitAddress, userPostsOrbitAddress,
userRegistrationTimestamp, userTopicsOrbitAddress, username,
]);
};
GeneralTab.defaultProps = {

6
packages/concordia-app/src/views/Profile/ProfilePostList/index.jsx

@ -30,8 +30,10 @@ const ProfilePostList = (props) => {
const [getUserPostCountCallHash, setGetUserPostCountCallHash] = useState(null);
const [getUserPostsCallHash, setGetUserPostsCallHash] = useState(null);
const getUserPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserPostCount[getUserPostCountCallHash]);
const getUserPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserPosts[getUserPostsCallHash]);
const getUserPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getUserPostCount[getUserPostCountCallHash]);
const getUserPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getUserPosts[getUserPostsCallHash]);
const { t } = useTranslation();

6
packages/concordia-app/src/views/Profile/ProfileTopicList/index.jsx

@ -30,8 +30,10 @@ const ProfileTopicList = (props) => {
const [getUserTopicCountCallHash, setGetUserTopicCountCallHash] = useState(null);
const [getUserTopicsCallHash, setGetUserTopicsCallHash] = useState(null);
const getUserTopicCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserTopicCount[getUserTopicCountCallHash]);
const getUserTopicsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getUserTopics[getUserTopicsCallHash]);
const getUserTopicCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getUserTopicCount[getUserTopicCountCallHash]);
const getUserTopicsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getUserTopics[getUserTopicsCallHash]);
const { t } = useTranslation();

6
packages/concordia-app/src/views/Topic/TopicView/TopicPostList/index.jsx

@ -30,8 +30,10 @@ const TopicPostList = (props) => {
const [getTopicPostCountCallHash, setGetTopicPostCountCallHash] = useState(null);
const [getTopicPostsCallHash, setGetTopicPostsCallHash] = useState(null);
const getTopicPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getTopicPostCount[getTopicPostCountCallHash]);
const getTopicPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT].getTopicPosts[getTopicPostsCallHash]);
const getTopicPostCountResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getTopicPostCount[getTopicPostCountCallHash]);
const getTopicPostsResult = useSelector((state) => state.contracts[FORUM_CONTRACT]
.getTopicPosts[getTopicPostsCallHash]);
useEffect(() => {
if (getTopicPostCountCallHash === null) {

Loading…
Cancel
Save