From cdee29e94ffa7cb616aacd34719114d384e60278 Mon Sep 17 00:00:00 2001 From: "Tom (plebeius.eth)" Date: Thu, 29 Aug 2024 14:18:20 +0200 Subject: [PATCH] feat(pending post): show board navigation, stats and post form --- src/app.tsx | 12 +++++++----- src/components/board-buttons/board-buttons.tsx | 8 +++----- src/views/pending-post/pending-post.tsx | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app.tsx b/src/app.tsx index ffba5fae..ce795174 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,7 +1,10 @@ import { useEffect, useState } from 'react'; import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; +import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import { isAllView, isSubscriptionsView } from './lib/utils/view-utils'; import useIsMobile from './hooks/use-is-mobile'; +import useTheme from './hooks/use-theme'; +import { timeFilterNames } from './hooks/use-time-filter'; import styles from './app.module.css'; import Board from './views/board'; import Catalog from './views/catalog'; @@ -16,8 +19,6 @@ import ChallengeModal from './components/challenge-modal'; import PostForm from './components/post-form'; import SubplebbitStats from './components/subplebbit-stats'; import TopBar from './components/topbar'; -import { timeFilterNames } from './hooks/use-time-filter'; -import useTheme from './hooks/use-theme'; const BoardLayout = () => { const { accountCommentIndex, subplebbitAddress, timeFilterName } = useParams(); @@ -25,8 +26,9 @@ const BoardLayout = () => { const isMobile = useIsMobile(); const isInAllView = isAllView(location.pathname, useParams()); const isInSubscriptionsView = isSubscriptionsView(location.pathname, useParams()); + const pendingPost = useAccountComment({ commentIndex: accountCommentIndex ? parseInt(accountCommentIndex) : undefined }); - const isValidAccountCommentIndex = !accountCommentIndex || (!isNaN(parseInt(accountCommentIndex)) && parseInt(accountCommentIndex) >= 0); + const isValidAccountCommentIndex = !accountCommentIndex || (!isNaN(Number(accountCommentIndex)) && Number(accountCommentIndex) >= 0); if (!isValidAccountCommentIndex || (timeFilterName && !timeFilterNames.includes(timeFilterName))) { return ; @@ -42,13 +44,13 @@ const BoardLayout = () => { {isMobile - ? (subplebbitAddress || isInAllView || isInSubscriptionsView) && ( + ? (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( <> ) - : (subplebbitAddress || isInAllView || isInSubscriptionsView) && ( + : (subplebbitAddress || isInAllView || isInSubscriptionsView || pendingPost?.subplebbitAddress) && ( <> {!(isInAllView || isInSubscriptionsView) && } diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index e6a319be..064672eb 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -267,11 +267,9 @@ export const DesktopBoardButtons = () => { ] [ ] - {isInPostView && ( - - - - )} + + + ) : ( <> diff --git a/src/views/pending-post/pending-post.tsx b/src/views/pending-post/pending-post.tsx index fae00bdf..72980b28 100644 --- a/src/views/pending-post/pending-post.tsx +++ b/src/views/pending-post/pending-post.tsx @@ -28,7 +28,7 @@ const PendingPost = () => { return ( <> {isInSettingsView && } - + ); };