Update app.tsx

This commit is contained in:
Tom (plebeius.eth)
2024-06-08 11:41:21 +02:00
parent e2169e959e
commit 0c2de0ea71
+5 -3
View File
@@ -1,6 +1,6 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom'; import { Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
import { isHomeView } from './lib/utils/view-utils'; import { isAllView, isHomeView, isSubscriptionsView } from './lib/utils/view-utils';
import useIsMobile from './hooks/use-is-mobile'; import useIsMobile from './hooks/use-is-mobile';
import useTheme from './hooks/use-theme'; import useTheme from './hooks/use-theme';
import styles from './app.module.css'; import styles from './app.module.css';
@@ -21,6 +21,8 @@ const BoardLayout = () => {
const { accountCommentIndex, subplebbitAddress } = useParams(); const { accountCommentIndex, subplebbitAddress } = useParams();
const location = useLocation(); const location = useLocation();
const isMobile = useIsMobile(); const isMobile = useIsMobile();
const isInAllView = isAllView(location.pathname);
const isInSubscriptionsView = isSubscriptionsView(location.pathname);
const isValidAccountCommentIndex = !accountCommentIndex || (!isNaN(parseInt(accountCommentIndex)) && parseInt(accountCommentIndex) >= 0); const isValidAccountCommentIndex = !accountCommentIndex || (!isNaN(parseInt(accountCommentIndex)) && parseInt(accountCommentIndex) >= 0);
@@ -36,13 +38,13 @@ const BoardLayout = () => {
<TopBar /> <TopBar />
<BoardHeader /> <BoardHeader />
{isMobile {isMobile
? subplebbitAddress && ( ? (subplebbitAddress || isInAllView || isInSubscriptionsView) && (
<> <>
<PostForm key={key} /> <PostForm key={key} />
<MobileBoardButtons /> <MobileBoardButtons />
</> </>
) )
: subplebbitAddress && ( : (subplebbitAddress || isInAllView || isInSubscriptionsView) && (
<> <>
<PostForm key={key} /> <PostForm key={key} />
<SubplebbitStats /> <SubplebbitStats />