diff --git a/ui/component/commentsReplies/index.js b/ui/component/commentsReplies/index.js index 8008d5535..9f6ae6bb3 100644 --- a/ui/component/commentsReplies/index.js +++ b/ui/component/commentsReplies/index.js @@ -7,7 +7,7 @@ import CommentsReplies from './view'; const select = (state, props) => ({ fetchedReplies: makeSelectRepliesForParentId(props.parentId)(state), claimIsMine: makeSelectClaimIsMine(props.uri)(state), - commentingEnabled: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true, + userCanComment: IS_WEB ? Boolean(selectUserVerifiedEmail(state)) : true, myChannels: selectMyChannelClaims(state), isFetchingByParentId: selectIsFetchingCommentsByParentId(state), }); diff --git a/ui/component/commentsReplies/view.jsx b/ui/component/commentsReplies/view.jsx index 83cec4219..ecbd973de 100644 --- a/ui/component/commentsReplies/view.jsx +++ b/ui/component/commentsReplies/view.jsx @@ -1,8 +1,8 @@ // @flow import * as ICONS from 'constants/icons'; -import React from 'react'; -import Comment from 'component/comment'; import Button from 'component/button'; +import Comment from 'component/comment'; +import React from 'react'; import Spinner from 'component/spinner'; type Props = { @@ -12,13 +12,13 @@ type Props = { claimIsMine: boolean, myChannels: ?Array, linkedCommentId?: string, - commentingEnabled: boolean, + userCanComment: boolean, threadDepth: number, numDirectReplies: number, // Total replies for parentId as reported by 'comment[replies]'. Includes blocked items. isFetchingByParentId: { [string]: boolean }, - onShowMore?: () => void, hasMore: boolean, supportDisabled: boolean, + onShowMore?: () => void, }; function CommentsReplies(props: Props) { @@ -29,99 +29,81 @@ function CommentsReplies(props: Props) { claimIsMine, myChannels, linkedCommentId, - commentingEnabled, + userCanComment, threadDepth, numDirectReplies, isFetchingByParentId, - onShowMore, hasMore, supportDisabled, + onShowMore, } = props; const [isExpanded, setExpanded] = React.useState(true); - function showMore() { - if (onShowMore) { - onShowMore(); - } - } + return !numDirectReplies ? null : ( +
+ {!isExpanded ? ( +
+
+ ) : ( +
+
+ )} + {isFetchingByParentId[parentId] && ( +
-
- )} - {isExpanded && ( -
-
-
-
- )} - {isExpanded && fetchedReplies && hasMore && ( -
-
- )} - {isFetchingByParentId[parentId] && ( -
-
- -
-
- )} -
- ) +
+ )} + ); }