diff --git a/package.json b/package.json index e78bffa9..a931f6c8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "dependencies": { "@capacitor/app": "1.1.1", "@floating-ui/react": "0.26.1", - "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#00aabcce2276c671c0f4a371d459c93eb39c936a", + "@plebbit/plebbit-react-hooks": "https://github.com/plebbit/plebbit-react-hooks.git#6d0d38ad52ce77715cb05be6cec55d691f5f013d", "@testing-library/jest-dom": "5.14.1", "@testing-library/react": "13.0.0", "@testing-library/user-event": "13.2.1", diff --git a/public/assets/banners/banner-54.jpg b/public/assets/banners/banner-54.jpg new file mode 100644 index 00000000..af18b974 Binary files /dev/null and b/public/assets/banners/banner-54.jpg differ diff --git a/public/assets/banners/banner-55.jpg b/public/assets/banners/banner-55.jpg new file mode 100644 index 00000000..4e2dd63c Binary files /dev/null and b/public/assets/banners/banner-55.jpg differ diff --git a/public/assets/banners/banner-56.jpg b/public/assets/banners/banner-56.jpg new file mode 100644 index 00000000..6b38f767 Binary files /dev/null and b/public/assets/banners/banner-56.jpg differ diff --git a/public/assets/banners/banner-57.png b/public/assets/banners/banner-57.png new file mode 100644 index 00000000..1f7cbe94 Binary files /dev/null and b/public/assets/banners/banner-57.png differ diff --git a/src/app.tsx b/src/app.tsx index 85072860..7112215a 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -1,20 +1,35 @@ import { useEffect } from 'react'; -import { Outlet, Route, Routes, useLocation } from 'react-router-dom'; +import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; import { isHomeView } from './lib/utils/view-utils'; import useTheme from './hooks/use-theme'; import styles from './app.module.css'; +import Board from './views/board'; import Catalog from './views/catalog'; import Home from './views/home'; +import PendingPost from './views/pending-post'; import PostPage from './views/post-page'; import Settings from './views/settings'; -import Board from './views/board'; -import BoardNav from './components/board-nav'; import BoardBanner from './components/board-banner'; -import { DesktopBoardButtons } from './components/board-buttons'; -import { MobileBoardButtons } from './components/board-buttons'; +import { DesktopBoardButtons, MobileBoardButtons } from './components/board-buttons'; +import BoardNav from './components/board-nav'; +import ChallengeModal from './components/challenge-modal'; import SubplebbitStats from './components/subplebbit-stats'; import PostForm from './components/post-form'; +const BoardLayout = () => { + const { subplebbitAddress } = useParams(); + return ( + <> + + + + + + + + + ); +}; const App = () => { const location = useLocation(); const isInHomeView = isHomeView(location.pathname); @@ -26,21 +41,9 @@ const App = () => { document.body.classList.add(theme); }, [theme]); - // const globalLayout = ( - // <> - // - // - // - // ); - - const boardLayout = ( + const globalLayout = ( <> - - - - - - + ); @@ -48,15 +51,21 @@ const App = () => { return (
- } /> - - } /> - } /> - } /> - } /> - } /> + + } /> + }> + } /> + + } /> + + } /> + } /> + } /> + + } /> + + } /> - } />
); diff --git a/src/components/board-banner/board-banner.tsx b/src/components/board-banner/board-banner.tsx index 803777b0..8b522ac3 100644 --- a/src/components/board-banner/board-banner.tsx +++ b/src/components/board-banner/board-banner.tsx @@ -1,9 +1,9 @@ import { useParams } from 'react-router-dom'; -import { useSubplebbit } from '@plebbit/plebbit-react-hooks'; +import { useAccountComment, useSubplebbit } from '@plebbit/plebbit-react-hooks'; import { useState } from 'react'; import styles from './board-banner.module.css'; -const totalBanners = 53; +const totalBanners = 57; const ImageBanner = () => { const [imagePath] = useState(() => { @@ -15,7 +15,10 @@ const ImageBanner = () => { }; const BoardBanner = () => { - const { subplebbitAddress } = useParams<{ subplebbitAddress: string }>(); + const params = useParams(); + const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any }); + const subplebbitAddress = params?.subplebbitAddress || accountComment?.subplebbitAddress; + const subplebbit = useSubplebbit({ subplebbitAddress }); const { address, title } = subplebbit || {}; const displayAddress = address && address.length > 10 && !address.includes('.') ? address.slice(0, 13).concat('...') : address; diff --git a/src/components/board-buttons/board-buttons.tsx b/src/components/board-buttons/board-buttons.tsx index 31b4a20f..4ff050ce 100644 --- a/src/components/board-buttons/board-buttons.tsx +++ b/src/components/board-buttons/board-buttons.tsx @@ -1,8 +1,8 @@ import { useTranslation } from 'react-i18next'; import { Link, useLocation, useParams } from 'react-router-dom'; -import { useSubscribe } from '@plebbit/plebbit-react-hooks'; +import { useAccountComment, useSubscribe } from '@plebbit/plebbit-react-hooks'; import styles from './board-buttons.module.css'; -import { isCatalogView, isPostPageView } from '../../lib/utils/view-utils'; +import { isCatalogView, isPendingPostView, isPostPageView } from '../../lib/utils/view-utils'; interface BoardButtonsProps { address: string | undefined; @@ -53,25 +53,30 @@ const BottomButton = () => { }; export const MobileBoardButtons = () => { - const { subplebbitAddress: address } = useParams<{ subplebbitAddress: string }>(); - const isInPostPage = isPostPageView(useLocation().pathname, useParams()); + const params = useParams(); + const location = useLocation(); + const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any }); + const subplebbitAddress = params?.subplebbitAddress || accountComment?.subplebbitAddress; + const isInPostPage = isPostPageView(location.pathname, params); + const isInPendingPostPage = isPendingPostView(location.pathname, params); + return (
- {isInPostPage ? ( + {isInPostPage || isInPendingPostPage ? (
- - + +
- +
) : ( <> - - + + )}
@@ -79,28 +84,30 @@ export const MobileBoardButtons = () => { }; export const DesktopBoardButtons = () => { - const { subplebbitAddress: address } = useParams<{ subplebbitAddress: string }>(); - - const location = useLocation(); const params = useParams(); + const location = useLocation(); + const accountComment = useAccountComment({ commentIndex: params?.accountCommentIndex as any }); + const subplebbitAddress = params?.subplebbitAddress || accountComment?.subplebbitAddress; const isInPostPage = isPostPageView(location.pathname, params); const isInCatalogView = isCatalogView(location.pathname, params); + const isInPendingPostPage = isPendingPostView(location.pathname, params); return (

- {isInPostPage ? ( + {isInPostPage || isInPendingPostPage ? ( <> - [] [] [] [] + [] [] [] [ + ] - [] + [] ) : ( <> - [] [] + [] [] - [] + [] )} diff --git a/src/components/board-nav/board-nav.tsx b/src/components/board-nav/board-nav.tsx index fae83e1d..a33d18a7 100644 --- a/src/components/board-nav/board-nav.tsx +++ b/src/components/board-nav/board-nav.tsx @@ -1,3 +1,4 @@ +import { useAccountComment } from '@plebbit/plebbit-react-hooks'; import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { isCatalogView } from '../../lib/utils/view-utils'; @@ -22,7 +23,7 @@ const BoardNavDesktop = ({ subplebbitAddresses }: BoardNavProps) => { {index === 0 ? null : ' '} {address.includes('.') ? address : address.slice(0, 10).concat('...')} - {index !== address.length - 1 ? ' /' : null} + {index !== subplebbitAddresses.length - 1 ? ' /' : null} ); })} @@ -49,8 +50,7 @@ const BoardNavMobile = ({ subplebbitAddresses, subplebbitAddress }: BoardNavProp {!currentSubplebbitIsInList && subplebbitAddress && } - {subplebbitAddresses.map((subplebbit: any, index: number) => { - const address = subplebbit?.address || ''; + {subplebbitAddresses.map((address: any, index: number) => { const subplebbitAddress = address?.includes('.') ? address : address?.slice(0, 10).concat('...'); return (