From 2968df7b3df9e321b4f88f0e34e5e7e3c59ea37e Mon Sep 17 00:00:00 2001 From: Apostolof Date: Sun, 15 Nov 2020 02:10:59 +0200 Subject: [PATCH] Refactor to use more descriptive variable names --- .../TopicList/TopicListRow/index.jsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx index 014baa9..61029a0 100644 --- a/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx +++ b/packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx @@ -19,7 +19,7 @@ const TopicListRow = (props) => { const { id: topicId, topicCallHash, loading } = props; const getTopicResults = useSelector((state) => state.contracts.Forum.getTopic); const [numberOfReplies, setNumberOfReplies] = useState(null); - const [username, setUsername] = useState(null); + const [topicAuthorAddress, setTopicAuthorAddress] = useState(null); const [topicAuthor, setTopicAuthor] = useState(null); const [timeAgo, setTimeAgo] = useState(null); const [topicSubject, setTopicSubject] = useState(null); @@ -31,22 +31,22 @@ const TopicListRow = (props) => { useEffect(() => { if (!loading && topicCallHash && getTopicResults[topicCallHash] !== undefined) { - setTopicAuthor(getTopicResults[topicCallHash].value[0]); - setUsername(getTopicResults[topicCallHash].value[1]); + setTopicAuthorAddress(getTopicResults[topicCallHash].value[0]); + setTopicAuthor(getTopicResults[topicCallHash].value[1]); setTimeAgo(moment(getTopicResults[topicCallHash].value[2] * 1000).fromNow()); setNumberOfReplies(getTopicResults[topicCallHash].value[3].length); } }, [getTopicResults, loading, topicCallHash]); useEffect(() => { - if (topicAuthor && userAddress !== topicAuthor) { + if (topicAuthorAddress && userAddress !== topicAuthorAddress) { dispatch({ type: FETCH_USER_DATABASE, orbit, - userAddress: topicAuthor, + userAddress: topicAuthorAddress, }); } - }, [dispatch, topicAuthor, userAddress]); + }, [dispatch, topicAuthorAddress, userAddress]); useEffect(() => { const topicFound = topics @@ -86,8 +86,8 @@ const TopicListRow = (props) => { - {username !== null && timeAgo !== null - ? t('topic.list.row.author.date', { author: username, timeAgo }) + {topicAuthor !== null && timeAgo !== null + ? t('topic.list.row.author.date', { author: topicAuthor, timeAgo }) : } @@ -104,7 +104,7 @@ const TopicListRow = (props) => { ); - }, [history, loading, numberOfReplies, t, timeAgo, topicId, topicSubject, username]); + }, [history, loading, numberOfReplies, t, timeAgo, topicAuthor, topicId, topicSubject]); }; TopicListRow.defaultProps = {