fix loading state of empty feed

This commit is contained in:
plebeius.eth
2023-07-06 13:14:20 +02:00
parent 02ce0a5474
commit 87fcc80898
6 changed files with 20 additions and 20 deletions
+3 -3
View File
@@ -585,7 +585,7 @@ const All = () => {
<Link to={`/p/all/catalog`}>Catalog</Link> <Link to={`/p/all/catalog`}>Catalog</Link>
] ]
</div> </div>
{feed.length > 0 ? ( {feed ? (
null null
) : ( ) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}> <div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -601,7 +601,7 @@ const All = () => {
<Tooltip id="tooltip" className="tooltip" /> <Tooltip id="tooltip" className="tooltip" />
<BoardForm selectedStyle={selectedStyle}> <BoardForm selectedStyle={selectedStyle}>
<div className="board"> <div className="board">
{feed.length > 0 ? ( {feed ? (
<Virtuoso <Virtuoso
increaseViewportBy={2000} increaseViewportBy={2000}
data={selectedFeed} data={selectedFeed}
@@ -2068,7 +2068,7 @@ const All = () => {
}} }}
endReached={tryLoadMore} endReached={tryLoadMore}
useWindowScroll={true} useWindowScroll={true}
components={{ Footer: hasMore ? () => <PostLoader /> : null }} components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/> />
) : ( ) : (
<PostLoader /> <PostLoader />
+2 -2
View File
@@ -442,7 +442,7 @@ const AllCatalog = () => {
<Link to={`/p/all`}>Return</Link> <Link to={`/p/all`}>Return</Link>
</span> </span>
</div> </div>
{feed.length > 0 ? ( {feed ? (
null null
) : ( ) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}> <div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -453,7 +453,7 @@ const AllCatalog = () => {
</TopBar> </TopBar>
<Tooltip id="tooltip" className="tooltip" /> <Tooltip id="tooltip" className="tooltip" />
<Threads selectedStyle={selectedStyle}> <Threads selectedStyle={selectedStyle}>
{feed.length > 0 ? ( {feed ? (
<InfiniteScroll <InfiniteScroll
pageStart={0} pageStart={0}
loadMore={tryLoadMore} loadMore={tryLoadMore}
+3 -3
View File
@@ -806,7 +806,7 @@ const Board = () => {
<Link to={`/p/${selectedAddress}/catalog`} onClick={()=> {window.scrollTo(0, 0)}}>Catalog</Link> <Link to={`/p/${selectedAddress}/catalog`} onClick={()=> {window.scrollTo(0, 0)}}>Catalog</Link>
] ]
</div> </div>
{feed.length > 0 ? ( {subplebbit?.state === "succeeded" ? (
<> <>
<span className="subscribe-button-desktop"> <span className="subscribe-button-desktop">
[ [
@@ -840,7 +840,7 @@ const Board = () => {
{subplebbit?.state === "failed" ? ( {subplebbit?.state === "failed" ? (
null null
) : ( ) : (
feed.length > 0 ? ( feed ? (
<> <>
{subplebbit.rules ? {subplebbit.rules ?
<> <>
@@ -2685,7 +2685,7 @@ const Board = () => {
}} }}
endReached={tryLoadMore} endReached={tryLoadMore}
useWindowScroll={true} useWindowScroll={true}
components={{ Footer: hasMore && feed.length > 0 ? () => <PostLoader /> : null }} components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/> />
</> </>
) : (<PostLoader />) ) : (<PostLoader />)
+2 -2
View File
@@ -665,7 +665,7 @@ const Catalog = () => {
<Link to={`/p/${selectedAddress}`} onClick={()=> {window.scrollTo(0, 0)}}>Return</Link> <Link to={`/p/${selectedAddress}`} onClick={()=> {window.scrollTo(0, 0)}}>Return</Link>
] ]
</div> </div>
{feed.length > 0 ? ( {feed ? (
<> <>
<span className="subscribe-button-desktop"> <span className="subscribe-button-desktop">
[ [
@@ -699,7 +699,7 @@ const Catalog = () => {
{subplebbit?.state === "failed" ? ( {subplebbit?.state === "failed" ? (
null null
) : ( ) : (
feed.length > 0 ? ( feed ? (
<InfiniteScroll <InfiniteScroll
pageStart={0} pageStart={0}
loadMore={tryLoadMore} loadMore={tryLoadMore}
+5 -5
View File
@@ -408,7 +408,7 @@ const Subscriptions = () => {
setCommentCid(comment.cid); setCommentCid(comment.cid);
setOriginalCommentContent(comment.content); setOriginalCommentContent(comment.content);
setIsEditModalOpen(true); setIsEditModalOpen(true);
} };
useEffect(() => { useEffect(() => {
@@ -563,7 +563,7 @@ const Subscriptions = () => {
</div> </div>
<> <>
<div className="board-title">Subscriptions</div> <div className="board-title">Subscriptions</div>
{feed.length < 1 ? ( {account.subscriptions.length < 1 ? (
<div className="board-address">You haven't subscribed to any board yet.</div> <div className="board-address">You haven't subscribed to any board yet.</div>
) : ( ) : (
<div className="board-address"> <div className="board-address">
@@ -593,7 +593,7 @@ const Subscriptions = () => {
<Link to={`/p/subscriptions/catalog`}>Catalog</Link> <Link to={`/p/subscriptions/catalog`}>Catalog</Link>
] ]
</div> </div>
{feed.length > 0 ? ( {feed ? (
null null
) : ( ) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}> <div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -609,7 +609,7 @@ const Subscriptions = () => {
<Tooltip id="tooltip" className="tooltip" /> <Tooltip id="tooltip" className="tooltip" />
<BoardForm selectedStyle={selectedStyle}> <BoardForm selectedStyle={selectedStyle}>
<div className="board"> <div className="board">
{ feed.length < 1 ? ( { feed ? (
null null
) : ( ) : (
<Virtuoso <Virtuoso
@@ -2078,7 +2078,7 @@ const Subscriptions = () => {
}} }}
endReached={tryLoadMore} endReached={tryLoadMore}
useWindowScroll={true} useWindowScroll={true}
components={{ Footer: hasMore ? () => <PostLoader /> : null }} components={{ Footer: hasMore && feed ? () => <PostLoader /> : null }}
/> />
)} )}
</div> </div>
@@ -411,7 +411,7 @@ const SubscriptionsCatalog = () => {
</div> </div>
<> <>
<div className="board-title">Subscriptions</div> <div className="board-title">Subscriptions</div>
{feed.length < 1 ? ( {account.subscriptions.length < 1 ? (
<div className="board-address">You haven't subscribed to any board yet.</div> <div className="board-address">You haven't subscribed to any board yet.</div>
) : ( ) : (
<div className="board-address"> <div className="board-address">
@@ -446,7 +446,7 @@ const SubscriptionsCatalog = () => {
<Link to={`/p/subscriptions`}>Return</Link> <Link to={`/p/subscriptions`}>Return</Link>
</span> </span>
</div> </div>
{feed.length > 0 ? ( {feed ? (
null null
) : ( ) : (
<div id="stats" style={{float: "right", marginTop: "5px"}}> <div id="stats" style={{float: "right", marginTop: "5px"}}>
@@ -457,7 +457,7 @@ const SubscriptionsCatalog = () => {
</TopBar> </TopBar>
<Tooltip id="tooltip" className="tooltip" /> <Tooltip id="tooltip" className="tooltip" />
<Threads selectedStyle={selectedStyle}> <Threads selectedStyle={selectedStyle}>
{feed.length > 0 ? ( {feed ? (
<InfiniteScroll <InfiniteScroll
pageStart={0} pageStart={0}
loadMore={tryLoadMore} loadMore={tryLoadMore}