mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Merge pull request #2208 from paulkaplan/fix-load-more
Use top level + replies count to control "Load More" comments button
This commit is contained in:
commit
f3b9826fd5
1 changed files with 2 additions and 1 deletions
|
@ -90,6 +90,7 @@ const PreviewPresentation = ({
|
||||||
onUpdate
|
onUpdate
|
||||||
}) => {
|
}) => {
|
||||||
const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : '';
|
const shareDate = ((projectInfo.history && projectInfo.history.shared)) ? projectInfo.history.shared : '';
|
||||||
|
const loadedCommentCount = comments.length + Object.keys(replies).reduce((acc, id) => acc + replies[id].length, 0);
|
||||||
return (
|
return (
|
||||||
<div className="preview">
|
<div className="preview">
|
||||||
{!isShared && (
|
{!isShared && (
|
||||||
|
@ -383,7 +384,7 @@ const PreviewPresentation = ({
|
||||||
onRestore={onRestoreComment}
|
onRestore={onRestoreComment}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
{comments.length < projectInfo.stats.comments &&
|
{loadedCommentCount < projectInfo.stats.comments &&
|
||||||
<Button
|
<Button
|
||||||
className="button load-more-button"
|
className="button load-more-button"
|
||||||
onClick={onLoadMore}
|
onClick={onLoadMore}
|
||||||
|
|
Loading…
Reference in a new issue