From baf0ff2465e8719dcb2705001572ebb8cbba1d62 Mon Sep 17 00:00:00 2001 From: plebbitor Date: Sat, 25 Mar 2023 15:22:03 +0100 Subject: [PATCH] update catalog loadMore --- src/components/views/Catalog.jsx | 125 ++++++++++++++++--------------- 1 file changed, 65 insertions(+), 60 deletions(-) diff --git a/src/components/views/Catalog.jsx b/src/components/views/Catalog.jsx index eba19fc9..8a0c4f60 100644 --- a/src/components/views/Catalog.jsx +++ b/src/components/views/Catalog.jsx @@ -45,7 +45,9 @@ const Catalog = () => { const { subplebbitAddress } = useParams(); const handleClickForm = useClickForm(); - + useEffect(() => { + console.log(feed); + }, [feed]); useEffect(() => { setSelectedAddress(subplebbitAddress); @@ -330,66 +332,69 @@ const Catalog = () => {
- } - > - {feed.map(thread => { - const commentMediaInfo = getCommentMediaInfo(thread); - const fallbackImgUrl = "/assets/filedeleted-res.gif"; - return ( -
- handleClickThread(thread.cid)}> - {commentMediaInfo?.url ? ( - - {commentMediaInfo?.type === "webpage" ? ( - thread { - e.target.src = fallbackImgUrl - e.target.onerror = null;}} /> - ) : null} - {commentMediaInfo?.type === "image" ? ( - thread { - e.target.src = fallbackImgUrl - e.target.onerror = null;}} /> - ) : null} - {commentMediaInfo?.type === "video" ? ( - { - const img = document.querySelector(`img[key="img-${thread.cid}"]`); - if (img) { - img.src = thumbnail; - } - }} - /> - ) : null} - {commentMediaInfo?.type === "audio" ? ( - thread { - e.target.src = fallbackImgUrl - e.target.onerror = null;}} /> - ) : null} - - ) : null} - - {/*
- -
*/} -
- R: - {thread.replyCount} + {feed.length < 1 ? ( + + ) : ( + + {feed.map(thread => { + const commentMediaInfo = getCommentMediaInfo(thread); + const fallbackImgUrl = "/assets/filedeleted-res.gif"; + return ( +
+ handleClickThread(thread.cid)}> + {commentMediaInfo?.url ? ( + + {commentMediaInfo?.type === "webpage" ? ( + thread { + e.target.src = fallbackImgUrl + e.target.onerror = null;}} /> + ) : null} + {commentMediaInfo?.type === "image" ? ( + thread { + e.target.src = fallbackImgUrl + e.target.onerror = null;}} /> + ) : null} + {commentMediaInfo?.type === "video" ? ( + { + const img = document.querySelector(`img[key="img-${thread.cid}"]`); + if (img) { + img.src = thumbnail; + } + }} + /> + ) : null} + {commentMediaInfo?.type === "audio" ? ( + thread { + e.target.src = fallbackImgUrl + e.target.onerror = null;}} /> + ) : null} + + ) : null} + + {/*
+ +
*/} +
+ R: + {thread.replyCount} +
+
+ {thread.title ? `${thread.title}` : null} + {thread.content ? `: ${thread.content}` : null} +
-
- {thread.title ? `${thread.title}` : null} - {thread.content ? `: ${thread.content}` : null} -
-
- )})} - + )})} + + )} );