mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix(codebase audit): preserve cleanup without regressions
Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
This commit is contained in:
+22
-31
@@ -1,4 +1,5 @@
|
||||
import { lazy, Suspense, useEffect } from 'react';
|
||||
import { useShallow } from 'zustand/react/shallow';
|
||||
import { Navigate, Outlet, Route, Routes, useLocation, useParams } from 'react-router-dom';
|
||||
import { useAccount, useCommunity } from '@bitsocial/bitsocial-react-hooks';
|
||||
import { initSnow, removeSnow } from './lib/snow';
|
||||
@@ -31,9 +32,7 @@ import {
|
||||
} from './lib/utils/route-utils';
|
||||
import styles from './app.module.css';
|
||||
import { DesktopBoardButtons, MobileAllFeedFilter, MobileBoardButtons } from './components/board-buttons';
|
||||
import Board from './views/board';
|
||||
import Blotter from './views/blotter';
|
||||
import Catalog from './views/catalog';
|
||||
import FAQ from './views/faq';
|
||||
import Home from './views/home';
|
||||
import Archive from './views/archive/archive';
|
||||
@@ -180,7 +179,27 @@ const BoardLayout = () => {
|
||||
const GlobalLayout = () => {
|
||||
useTheme();
|
||||
|
||||
const { activeCid, parentNumber, threadNumber, threadCid, communityAddress: activeCommunityAddress, closeModal, showReplyModal, scrollY } = useReplyModalStore();
|
||||
const {
|
||||
activeCid,
|
||||
parentNumber,
|
||||
threadNumber,
|
||||
threadCid,
|
||||
communityAddress: activeCommunityAddress,
|
||||
closeModal,
|
||||
showReplyModal,
|
||||
scrollY,
|
||||
} = useReplyModalStore(
|
||||
useShallow((state) => ({
|
||||
activeCid: state.activeCid,
|
||||
parentNumber: state.parentNumber,
|
||||
threadNumber: state.threadNumber,
|
||||
threadCid: state.threadCid,
|
||||
communityAddress: state.communityAddress,
|
||||
closeModal: state.closeModal,
|
||||
showReplyModal: state.showReplyModal,
|
||||
scrollY: state.scrollY,
|
||||
})),
|
||||
);
|
||||
|
||||
const location = useLocation();
|
||||
const isInSettingsView = location.pathname.endsWith('/settings');
|
||||
@@ -215,34 +234,6 @@ const GlobalLayout = () => {
|
||||
);
|
||||
};
|
||||
|
||||
/** Wraps Board with viewType/boardIdentifier derived from current route. Used when infinite scroll is OFF. */
|
||||
const BoardFeedRoute = () => {
|
||||
const location = useLocation();
|
||||
const params = useParams();
|
||||
const viewType: 'all' | 'subs' | 'mod' | 'board' = isAllView(location.pathname)
|
||||
? 'all'
|
||||
: isSubscriptionsView(location.pathname, params)
|
||||
? 'subs'
|
||||
: isModView(location.pathname)
|
||||
? 'mod'
|
||||
: 'board';
|
||||
return <Board viewType={viewType} boardIdentifier={params.boardIdentifier} />;
|
||||
};
|
||||
|
||||
/** Wraps Catalog with viewType/boardIdentifier derived from current route. Used when infinite scroll is OFF. */
|
||||
const CatalogFeedRoute = () => {
|
||||
const location = useLocation();
|
||||
const params = useParams();
|
||||
const viewType: 'all' | 'subs' | 'mod' | 'board' = isAllView(location.pathname)
|
||||
? 'all'
|
||||
: isSubscriptionsView(location.pathname, params)
|
||||
? 'subs'
|
||||
: isModView(location.pathname)
|
||||
? 'mod'
|
||||
: 'board';
|
||||
return <Catalog viewType={viewType} boardIdentifier={params.boardIdentifier} />;
|
||||
};
|
||||
|
||||
const ModQueueRoute = () => {
|
||||
const { boardIdentifier } = useParams();
|
||||
const account = useAccount();
|
||||
|
||||
Reference in New Issue
Block a user