diff --git a/src/views/board/board.tsx b/src/views/board/board.tsx index e0a92c07..440ef477 100644 --- a/src/views/board/board.tsx +++ b/src/views/board/board.tsx @@ -121,27 +121,7 @@ const Board = () => { const { blocked, unblock } = useBlock({ address: subplebbitAddress }); const loadingStateString = useFeedStateString(subplebbitAddresses) || t('loading'); - const loadingString = ( -
- {state === 'failed' ? ( - {state} - ) : isInSubscriptionsView && subscriptions?.length === 0 ? ( - t('not_subscribed_to_any_board') - ) : blocked ? ( - 'you have blocked this board' - ) : !hasMore && feed.length === 0 ? ( - t('no_posts') - ) : ( - hasMore && - )} - {error && ( -
-
- {error.message} -
- )} -
- ); + const loadingString =
; const handleNewerPostsButtonClick = () => { window.scrollTo({ top: 0, left: 0 }); @@ -219,13 +199,46 @@ const Board = () => { )) )} -
- -
); } - return
{footerContent}
; + return ( +
+ {footerContent} +
+ {state === 'failed' ? ( + {state} + ) : isInSubscriptionsView && subscriptions?.length === 0 ? ( + t('not_subscribed_to_any_board') + ) : blocked ? ( + 'you have blocked this board' + ) : ( + hasMore && + )} + {error && ( +
+
+ {error.message} +
+ )} + {blocked && ( + <> +   [ + { + unblock(); + reset(); + }} + > + Unblock + + ] + + )} +
+
+ ); }; // save the last Virtuoso state to restore it when navigating back @@ -273,47 +286,24 @@ const Board = () => { title={title} /> )} - {feed.length !== 0 ? ( - <> - {rules && !description && rules.length > 0 && } - { - const { deleted, locked, removed } = post || {}; - const isThreadClosed = deleted || locked || removed; + {rules && !description && rules.length > 0 && } + { + const { deleted, locked, removed } = post || {}; + const isThreadClosed = deleted || locked || removed; - return alert(t('thread_closed_alert')) : openReplyModal} />; - }} - useWindowScroll={true} - components={{ Footer }} - endReached={loadMore} - ref={virtuosoRef} - restoreStateFrom={lastVirtuosoState} - initialScrollTop={lastVirtuosoState?.scrollTop} - /> - - ) : ( -
- {loadingString} - {blocked && ( - <> -   [ - { - unblock(); - reset(); - }} - > - Unblock - - ] - - )} -
- )} + return alert(t('thread_closed_alert')) : openReplyModal} />; + }} + useWindowScroll={true} + components={{ Footer }} + endReached={loadMore} + ref={virtuosoRef} + restoreStateFrom={lastVirtuosoState} + initialScrollTop={lastVirtuosoState?.scrollTop} + /> ); };