2019-05-17 20:21:07 +02:00
|
|
|
// @flow
|
2021-09-01 09:55:00 +02:00
|
|
|
import { COMMENT_HIGHLIGHTED } from 'constants/classnames';
|
2021-07-15 16:43:28 +02:00
|
|
|
import { COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY } from 'constants/comment';
|
2021-10-04 13:53:41 +02:00
|
|
|
import { ENABLE_COMMENT_REACTIONS } from 'config';
|
|
|
|
import { getChannelIdFromClaim } from 'util/claim';
|
|
|
|
import { useIsMobile, useIsMediumScreen } from 'effects/use-screensize';
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import * as REACTION_TYPES from 'constants/reactions';
|
2020-08-24 19:35:21 +02:00
|
|
|
import Button from 'component/button';
|
|
|
|
import Card from 'component/common/card';
|
2021-10-04 13:53:41 +02:00
|
|
|
import classnames from 'classnames';
|
2020-08-24 19:35:21 +02:00
|
|
|
import CommentCreate from 'component/commentCreate';
|
2021-10-04 13:53:41 +02:00
|
|
|
import CommentView from 'component/comment';
|
2021-07-15 16:43:28 +02:00
|
|
|
import debounce from 'util/debounce';
|
2021-10-04 13:53:41 +02:00
|
|
|
import Empty from 'component/common/empty';
|
|
|
|
import React, { useEffect } from 'react';
|
|
|
|
import Spinner from 'component/spinner';
|
2021-10-01 09:49:37 +02:00
|
|
|
import useFetched from 'effects/use-fetched';
|
2021-10-04 13:53:41 +02:00
|
|
|
import usePersistedState from 'effects/use-persisted-state';
|
2021-07-15 16:43:28 +02:00
|
|
|
|
|
|
|
const DEBOUNCE_SCROLL_HANDLER_MS = 200;
|
|
|
|
|
|
|
|
function scaleToDevicePixelRatio(value) {
|
|
|
|
const devicePixelRatio = window.devicePixelRatio || 1.0;
|
|
|
|
if (devicePixelRatio < 1.0) {
|
|
|
|
return Math.ceil(value / devicePixelRatio);
|
|
|
|
}
|
|
|
|
return Math.ceil(value * devicePixelRatio);
|
|
|
|
}
|
2019-05-17 20:21:07 +02:00
|
|
|
|
2019-06-27 01:59:27 +02:00
|
|
|
type Props = {
|
2021-07-15 16:43:28 +02:00
|
|
|
allCommentIds: any,
|
2021-08-17 18:09:55 +02:00
|
|
|
pinnedComments: Array<Comment>,
|
2021-07-15 16:43:28 +02:00
|
|
|
topLevelComments: Array<Comment>,
|
|
|
|
topLevelTotalPages: number,
|
2019-05-17 20:21:07 +02:00
|
|
|
uri: string,
|
2021-07-29 16:53:36 +02:00
|
|
|
claim: ?Claim,
|
2020-01-30 02:02:21 +01:00
|
|
|
claimIsMine: boolean,
|
|
|
|
myChannels: ?Array<ChannelClaim>,
|
2020-05-25 20:45:43 +02:00
|
|
|
isFetchingComments: boolean,
|
2021-10-01 09:49:37 +02:00
|
|
|
isFetchingCommentsById: boolean,
|
2021-07-15 18:13:01 +02:00
|
|
|
isFetchingReacts: boolean,
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentId?: string,
|
2020-09-30 20:46:17 +02:00
|
|
|
totalComments: number,
|
2020-10-02 23:17:12 +02:00
|
|
|
fetchingChannels: boolean,
|
2021-07-15 16:43:28 +02:00
|
|
|
myReactsByCommentId: ?{ [string]: Array<string> }, // "CommentId:MyChannelId" -> reaction array (note the ID concatenation)
|
|
|
|
othersReactsById: ?{ [string]: { [REACTION_TYPES.LIKE | REACTION_TYPES.DISLIKE]: number } },
|
2021-02-09 17:05:56 +01:00
|
|
|
activeChannelId: ?string,
|
2021-07-29 16:53:36 +02:00
|
|
|
settingsByChannelId: { [channelId: string]: PerChannelSettings },
|
2021-10-10 13:33:40 +02:00
|
|
|
fetchReacts: (Array<string>) => Promise<any>,
|
2021-10-11 03:43:29 +02:00
|
|
|
commentsAreExpanded?: boolean,
|
2021-10-04 13:53:41 +02:00
|
|
|
fetchTopLevelComments: (string, number, number, number) => void,
|
|
|
|
fetchComment: (string) => void,
|
|
|
|
resetComments: (string) => void,
|
2019-05-17 20:21:07 +02:00
|
|
|
};
|
|
|
|
|
2019-06-27 01:59:27 +02:00
|
|
|
function CommentList(props: Props) {
|
2020-09-29 16:10:23 +02:00
|
|
|
const {
|
2021-07-15 16:43:28 +02:00
|
|
|
allCommentIds,
|
2020-09-29 16:10:23 +02:00
|
|
|
uri,
|
2021-08-17 18:09:55 +02:00
|
|
|
pinnedComments,
|
2021-07-15 16:43:28 +02:00
|
|
|
topLevelComments,
|
|
|
|
topLevelTotalPages,
|
2021-07-29 16:53:36 +02:00
|
|
|
claim,
|
2020-09-29 16:10:23 +02:00
|
|
|
claimIsMine,
|
|
|
|
myChannels,
|
|
|
|
isFetchingComments,
|
2021-10-01 09:49:37 +02:00
|
|
|
isFetchingCommentsById,
|
2021-07-15 18:13:01 +02:00
|
|
|
isFetchingReacts,
|
2021-07-15 16:43:28 +02:00
|
|
|
linkedCommentId,
|
2020-09-30 20:46:17 +02:00
|
|
|
totalComments,
|
2020-10-02 23:17:12 +02:00
|
|
|
fetchingChannels,
|
2021-07-15 16:43:28 +02:00
|
|
|
myReactsByCommentId,
|
|
|
|
othersReactsById,
|
2021-02-09 17:05:56 +01:00
|
|
|
activeChannelId,
|
2021-07-29 16:53:36 +02:00
|
|
|
settingsByChannelId,
|
2021-10-10 13:33:40 +02:00
|
|
|
fetchReacts,
|
2021-10-11 03:43:29 +02:00
|
|
|
commentsAreExpanded,
|
2021-10-04 13:53:41 +02:00
|
|
|
fetchTopLevelComments,
|
|
|
|
fetchComment,
|
|
|
|
resetComments,
|
2020-09-29 16:10:23 +02:00
|
|
|
} = props;
|
2021-07-15 16:43:28 +02:00
|
|
|
|
2021-10-04 13:53:41 +02:00
|
|
|
const isMobile = useIsMobile();
|
|
|
|
const isMediumScreen = useIsMediumScreen();
|
2020-10-06 21:35:13 +02:00
|
|
|
const spinnerRef = React.useRef();
|
2021-07-15 16:43:28 +02:00
|
|
|
const DEFAULT_SORT = ENABLE_COMMENT_REACTIONS ? SORT_BY.POPULARITY : SORT_BY.NEWEST;
|
|
|
|
const [sort, setSort] = usePersistedState('comment-sort-by', DEFAULT_SORT);
|
|
|
|
const [page, setPage] = React.useState(0);
|
2021-10-04 13:53:41 +02:00
|
|
|
const fetchedCommentsOnce = useFetched(isFetchingComments);
|
|
|
|
const fetchedReactsOnce = useFetched(isFetchingReacts);
|
|
|
|
const fetchedLinkedComment = useFetched(isFetchingCommentsById);
|
2021-10-04 21:25:43 +02:00
|
|
|
const hasDefaultExpansion = commentsAreExpanded || (!isMobile && !isMediumScreen);
|
|
|
|
const [expandedComments, setExpandedComments] = React.useState(hasDefaultExpansion);
|
2021-07-15 16:43:28 +02:00
|
|
|
const totalFetchedComments = allCommentIds ? allCommentIds.length : 0;
|
2021-07-29 16:53:36 +02:00
|
|
|
const channelId = getChannelIdFromClaim(claim);
|
|
|
|
const channelSettings = channelId ? settingsByChannelId[channelId] : undefined;
|
2021-10-04 13:53:41 +02:00
|
|
|
const moreBelow = page < topLevelTotalPages;
|
2020-10-28 03:07:40 +01:00
|
|
|
|
2020-10-06 21:35:13 +02:00
|
|
|
// Display comments immediately if not fetching reactions
|
|
|
|
// If not, wait to show comments until reactions are fetched
|
2020-10-20 19:10:02 +02:00
|
|
|
const [readyToDisplayComments, setReadyToDisplayComments] = React.useState(
|
2021-07-15 16:43:28 +02:00
|
|
|
Boolean(othersReactsById) || !ENABLE_COMMENT_REACTIONS
|
2020-10-20 19:10:02 +02:00
|
|
|
);
|
2021-07-15 16:43:28 +02:00
|
|
|
|
|
|
|
function changeSort(newSort) {
|
|
|
|
if (sort !== newSort) {
|
|
|
|
setSort(newSort);
|
|
|
|
setPage(0); // Invalidate existing comments
|
2020-08-24 19:35:21 +02:00
|
|
|
}
|
2021-07-15 16:43:28 +02:00
|
|
|
}
|
2020-08-24 19:35:21 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
// Reset comments
|
2019-06-27 01:59:27 +02:00
|
|
|
useEffect(() => {
|
2021-07-15 16:43:28 +02:00
|
|
|
if (page === 0) {
|
2021-10-01 14:10:27 +02:00
|
|
|
if (claim) {
|
|
|
|
resetComments(claim.claim_id);
|
|
|
|
}
|
2021-07-15 16:43:28 +02:00
|
|
|
setPage(1);
|
|
|
|
}
|
2021-10-01 14:10:27 +02:00
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
}, [page, uri, resetComments]); // 'claim' is derived from 'uri'
|
2019-06-27 01:59:27 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
// Fetch top-level comments
|
2020-10-01 20:43:44 +02:00
|
|
|
useEffect(() => {
|
2021-07-15 16:43:28 +02:00
|
|
|
if (page !== 0) {
|
|
|
|
if (page === 1 && linkedCommentId) {
|
|
|
|
fetchComment(linkedCommentId);
|
|
|
|
}
|
|
|
|
|
|
|
|
fetchTopLevelComments(uri, page, COMMENT_PAGE_SIZE_TOP_LEVEL, sort);
|
|
|
|
}
|
2021-10-04 13:53:41 +02:00
|
|
|
}, [fetchComment, fetchTopLevelComments, linkedCommentId, page, sort, uri]);
|
2021-07-15 16:43:28 +02:00
|
|
|
|
|
|
|
// Fetch reacts
|
|
|
|
useEffect(() => {
|
2021-07-15 18:13:01 +02:00
|
|
|
if (totalFetchedComments > 0 && ENABLE_COMMENT_REACTIONS && !fetchingChannels && !isFetchingReacts) {
|
2021-07-15 16:43:28 +02:00
|
|
|
let idsForReactionFetch;
|
|
|
|
|
|
|
|
if (!othersReactsById || !myReactsByCommentId) {
|
|
|
|
idsForReactionFetch = allCommentIds;
|
|
|
|
} else {
|
|
|
|
idsForReactionFetch = allCommentIds.filter((commentId) => {
|
|
|
|
const key = activeChannelId ? `${commentId}:${activeChannelId}` : commentId;
|
|
|
|
return !othersReactsById[key] || (activeChannelId && !myReactsByCommentId[key]);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-07-20 05:14:56 +02:00
|
|
|
if (idsForReactionFetch.length !== 0) {
|
2021-07-15 16:43:28 +02:00
|
|
|
fetchReacts(idsForReactionFetch)
|
|
|
|
.then(() => {
|
|
|
|
setReadyToDisplayComments(true);
|
|
|
|
})
|
|
|
|
.catch(() => setReadyToDisplayComments(true));
|
|
|
|
}
|
2021-06-17 05:11:40 +02:00
|
|
|
}
|
2021-07-15 16:43:28 +02:00
|
|
|
}, [
|
2021-10-04 13:53:41 +02:00
|
|
|
activeChannelId,
|
2021-07-15 16:43:28 +02:00
|
|
|
allCommentIds,
|
|
|
|
fetchReacts,
|
|
|
|
fetchingChannels,
|
2021-07-15 18:13:01 +02:00
|
|
|
isFetchingReacts,
|
2021-10-04 13:53:41 +02:00
|
|
|
myReactsByCommentId,
|
|
|
|
othersReactsById,
|
|
|
|
totalFetchedComments,
|
2021-07-15 16:43:28 +02:00
|
|
|
]);
|
2020-09-29 16:10:23 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
// Scroll to linked-comment
|
2020-08-24 19:35:21 +02:00
|
|
|
useEffect(() => {
|
2021-10-01 09:49:37 +02:00
|
|
|
if (fetchedLinkedComment && fetchedCommentsOnce && fetchedReactsOnce) {
|
2021-09-01 09:55:00 +02:00
|
|
|
const elems = document.getElementsByClassName(COMMENT_HIGHLIGHTED);
|
|
|
|
if (elems.length > 0) {
|
2021-10-01 09:49:37 +02:00
|
|
|
const ROUGH_HEADER_HEIGHT = 125; // @see: --header-height
|
2021-09-01 09:55:00 +02:00
|
|
|
const linkedComment = elems[0];
|
2021-10-01 09:49:37 +02:00
|
|
|
window.scrollTo({
|
|
|
|
top: linkedComment.getBoundingClientRect().top + window.scrollY - ROUGH_HEADER_HEIGHT,
|
|
|
|
left: 0,
|
|
|
|
behavior: 'smooth',
|
|
|
|
});
|
2021-09-01 09:55:00 +02:00
|
|
|
}
|
2020-08-24 19:35:21 +02:00
|
|
|
}
|
2021-10-01 09:49:37 +02:00
|
|
|
}, [fetchedLinkedComment, fetchedCommentsOnce, fetchedReactsOnce]);
|
2020-02-05 04:55:00 +01:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
// Infinite scroll
|
2020-10-05 23:25:23 +02:00
|
|
|
useEffect(() => {
|
2021-07-15 16:43:28 +02:00
|
|
|
function shouldFetchNextPage(page, topLevelTotalPages, window, document, yPrefetchPx = 1000) {
|
2021-10-04 13:53:41 +02:00
|
|
|
if (!spinnerRef || !spinnerRef.current) return false;
|
2021-07-15 16:43:28 +02:00
|
|
|
|
|
|
|
const rect = spinnerRef.current.getBoundingClientRect(); // $FlowFixMe
|
|
|
|
const windowH = window.innerHeight || document.documentElement.clientHeight; // $FlowFixMe
|
|
|
|
const windowW = window.innerWidth || document.documentElement.clientWidth; // $FlowFixMe
|
|
|
|
|
|
|
|
const isApproachingViewport = yPrefetchPx !== 0 && rect.top < windowH + scaleToDevicePixelRatio(yPrefetchPx);
|
2020-10-06 21:35:13 +02:00
|
|
|
|
|
|
|
const isInViewport =
|
2021-07-15 16:43:28 +02:00
|
|
|
rect.width > 0 &&
|
|
|
|
rect.height > 0 &&
|
|
|
|
rect.bottom >= 0 &&
|
|
|
|
rect.right >= 0 &&
|
2020-10-06 21:35:13 +02:00
|
|
|
// $FlowFixMe
|
2021-07-15 16:43:28 +02:00
|
|
|
rect.top <= windowH &&
|
2020-10-06 21:35:13 +02:00
|
|
|
// $FlowFixMe
|
2021-07-15 16:43:28 +02:00
|
|
|
rect.left <= windowW;
|
2021-07-14 05:06:47 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
return (isInViewport || isApproachingViewport) && page < topLevelTotalPages;
|
2021-07-15 16:23:26 +02:00
|
|
|
}
|
2020-10-05 23:25:23 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
const handleCommentScroll = debounce(() => {
|
2021-10-04 21:25:43 +02:00
|
|
|
if (hasDefaultExpansion && shouldFetchNextPage(page, topLevelTotalPages, window, document)) {
|
2021-07-15 16:43:28 +02:00
|
|
|
setPage(page + 1);
|
|
|
|
}
|
|
|
|
}, DEBOUNCE_SCROLL_HANDLER_MS);
|
2021-07-15 16:23:26 +02:00
|
|
|
|
2021-07-15 16:43:28 +02:00
|
|
|
if (!isFetchingComments && readyToDisplayComments && moreBelow && spinnerRef && spinnerRef.current) {
|
|
|
|
if (shouldFetchNextPage(page, topLevelTotalPages, window, document, 0)) {
|
|
|
|
setPage(page + 1);
|
2021-07-14 05:06:47 +02:00
|
|
|
} else {
|
2021-07-15 16:43:28 +02:00
|
|
|
window.addEventListener('scroll', handleCommentScroll);
|
|
|
|
return () => window.removeEventListener('scroll', handleCommentScroll);
|
2021-07-14 05:06:47 +02:00
|
|
|
}
|
2020-10-05 23:25:23 +02:00
|
|
|
}
|
2021-10-04 21:25:43 +02:00
|
|
|
}, [hasDefaultExpansion, isFetchingComments, moreBelow, page, readyToDisplayComments, topLevelTotalPages]);
|
2020-02-05 04:55:00 +01:00
|
|
|
|
2021-10-11 03:43:29 +02:00
|
|
|
const getCommentElems = (comments) => {
|
|
|
|
return comments.map((comment) => (
|
2021-10-04 13:53:41 +02:00
|
|
|
<CommentView
|
|
|
|
isTopLevel
|
|
|
|
threadDepth={3}
|
|
|
|
key={comment.comment_id}
|
|
|
|
uri={uri}
|
|
|
|
authorUri={comment.channel_url}
|
|
|
|
author={comment.channel_name}
|
|
|
|
claimId={comment.claim_id}
|
|
|
|
commentId={comment.comment_id}
|
|
|
|
message={comment.comment}
|
|
|
|
timePosted={comment.timestamp * 1000}
|
|
|
|
claimIsMine={claimIsMine}
|
|
|
|
commentIsMine={
|
|
|
|
comment.channel_id && myChannels && myChannels.some(({ claim_id }) => claim_id === comment.channel_id)
|
|
|
|
}
|
|
|
|
linkedCommentId={linkedCommentId}
|
|
|
|
isPinned={comment.is_pinned}
|
|
|
|
supportAmount={comment.support_amount}
|
|
|
|
numDirectReplies={comment.replies}
|
|
|
|
isModerator={comment.is_moderator}
|
|
|
|
isGlobalMod={comment.is_global_mod}
|
|
|
|
isFiat={comment.is_fiat}
|
|
|
|
/>
|
|
|
|
));
|
2021-10-11 03:43:29 +02:00
|
|
|
};
|
2021-10-04 13:53:41 +02:00
|
|
|
|
2021-10-11 03:43:29 +02:00
|
|
|
const sortButton = (label, icon, sortOption) => {
|
|
|
|
return (
|
|
|
|
<Button
|
|
|
|
button="alt"
|
|
|
|
label={label}
|
|
|
|
icon={icon}
|
|
|
|
iconSize={18}
|
|
|
|
onClick={() => changeSort(sortOption)}
|
|
|
|
className={classnames(`button-toggle`, {
|
|
|
|
'button-toggle--active': sort === sortOption,
|
|
|
|
})}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2021-09-20 16:20:28 +02:00
|
|
|
|
2019-06-27 01:59:27 +02:00
|
|
|
return (
|
2020-08-24 19:35:21 +02:00
|
|
|
<Card
|
2021-09-30 23:30:32 +02:00
|
|
|
className="card--enable-overflow"
|
2020-08-31 18:28:28 +02:00
|
|
|
title={
|
2021-10-04 13:53:41 +02:00
|
|
|
(totalComments === 0 && __('Leave a comment')) ||
|
|
|
|
(totalComments === 1 && __('1 comment')) ||
|
|
|
|
__('%totalComments% comments', { totalComments })
|
2020-08-31 18:28:28 +02:00
|
|
|
}
|
2020-10-02 06:47:54 +02:00
|
|
|
titleActions={
|
2020-10-06 21:35:13 +02:00
|
|
|
<>
|
|
|
|
{totalComments > 1 && ENABLE_COMMENT_REACTIONS && (
|
|
|
|
<span className="comment__sort">
|
2021-10-04 13:53:41 +02:00
|
|
|
{sortButton(__('Best'), ICONS.BEST, SORT_BY.POPULARITY)}
|
|
|
|
{sortButton(__('Controversial'), ICONS.CONTROVERSIAL, SORT_BY.CONTROVERSY)}
|
|
|
|
{sortButton(__('New'), ICONS.NEW, SORT_BY.NEWEST)}
|
2020-10-06 21:35:13 +02:00
|
|
|
</span>
|
|
|
|
)}
|
2021-10-04 13:53:41 +02:00
|
|
|
<Button button="alt" icon={ICONS.REFRESH} title={__('Refresh')} onClick={() => setPage(0)} />
|
2020-10-06 21:35:13 +02:00
|
|
|
</>
|
2020-10-02 06:47:54 +02:00
|
|
|
}
|
2020-08-24 19:35:21 +02:00
|
|
|
actions={
|
|
|
|
<>
|
2021-07-15 16:43:28 +02:00
|
|
|
<CommentCreate uri={uri} />
|
2020-10-07 21:14:52 +02:00
|
|
|
|
2021-10-04 13:53:41 +02:00
|
|
|
{channelSettings && channelSettings.comments_enabled && !isFetchingComments && !totalComments && (
|
2020-12-16 19:31:07 +01:00
|
|
|
<Empty padded text={__('That was pretty deep. What do you think?')} />
|
|
|
|
)}
|
2020-10-07 21:14:52 +02:00
|
|
|
|
2021-08-03 17:03:08 +02:00
|
|
|
<ul
|
|
|
|
className={classnames({
|
|
|
|
comments: expandedComments,
|
2021-07-15 15:25:48 +02:00
|
|
|
'comments--contracted': !expandedComments,
|
2021-08-03 17:03:08 +02:00
|
|
|
})}
|
|
|
|
>
|
2021-08-17 18:09:55 +02:00
|
|
|
{readyToDisplayComments && pinnedComments && getCommentElems(pinnedComments)}
|
2021-10-11 03:43:29 +02:00
|
|
|
{readyToDisplayComments && topLevelComments && getCommentElems(topLevelComments)}
|
2020-08-24 19:35:21 +02:00
|
|
|
</ul>
|
2020-10-07 21:14:52 +02:00
|
|
|
|
2021-10-04 21:25:43 +02:00
|
|
|
{!hasDefaultExpansion && (
|
2021-07-15 15:25:48 +02:00
|
|
|
<div className="card__bottom-actions--comments">
|
2021-08-04 14:44:36 +02:00
|
|
|
{(!expandedComments || moreBelow) && (
|
2021-07-15 15:25:48 +02:00
|
|
|
<Button
|
2021-08-03 17:03:08 +02:00
|
|
|
button="link"
|
2021-10-04 13:53:41 +02:00
|
|
|
title={!expandedComments ? __('Expand') : __('More')}
|
2021-08-03 17:03:08 +02:00
|
|
|
label={!expandedComments ? __('Expand') : __('More')}
|
2021-10-04 13:53:41 +02:00
|
|
|
onClick={() => (!expandedComments ? setExpandedComments(true) : setPage(page + 1))}
|
2021-07-15 15:25:48 +02:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
{expandedComments && (
|
|
|
|
<Button
|
2021-08-03 17:03:08 +02:00
|
|
|
button="link"
|
2021-10-04 13:53:41 +02:00
|
|
|
title={__('Collapse')}
|
2021-08-03 17:03:08 +02:00
|
|
|
label={__('Collapse')}
|
2021-10-04 13:53:41 +02:00
|
|
|
onClick={() => setExpandedComments(false)}
|
2021-07-15 15:25:48 +02:00
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
|
2021-10-04 21:25:43 +02:00
|
|
|
{(isFetchingComments || (hasDefaultExpansion && moreBelow)) && (
|
2020-10-06 21:35:13 +02:00
|
|
|
<div className="main--empty" ref={spinnerRef}>
|
2020-10-05 23:25:23 +02:00
|
|
|
<Spinner type="small" />
|
2020-08-24 19:35:21 +02:00
|
|
|
</div>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
}
|
|
|
|
/>
|
2019-06-27 01:59:27 +02:00
|
|
|
);
|
2019-05-17 20:21:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export default CommentList;
|