feat(settings): move account json editing to dedicated full editor route

This commit is contained in:
plebeius
2026-02-24 20:33:07 +08:00
parent dc43a8438e
commit fb9443a0f8
47 changed files with 852 additions and 219 deletions
+16 -10
View File
@@ -34,6 +34,7 @@ import PostForm from './components/post-form';
import BoardBlotter from './components/board-blotter';
import BoardsBar from './components/boardsbar';
const AccountDataEditor = lazy(() => import('./views/account-data-editor'));
const BoardsBarEditModal = lazy(() => import('./components/boardsbar-edit-modal'));
const CreateBoardModal = lazy(() => import('./components/create-board-modal'));
const DirectoryModal = lazy(() => import('./components/directory-modal'));
@@ -47,7 +48,7 @@ preloadThemeAssets();
const hasModQueueAccessRole = (role?: string): boolean => role === 'admin' || role === 'owner' || role === 'moderator';
const BoardLayout = () => {
const { accountCommentIndex, boardIdentifier } = useParams();
const { accountCommentIndex, boardIdentifier, pageNumber } = useParams();
const location = useLocation();
const isMobile = useIsMobile();
const isInAllView = isAllView(location.pathname);
@@ -83,6 +84,10 @@ const BoardLayout = () => {
? `${subplebbitAddress}-${location.pathname.replace(/\/settings$/, '')}`
: `${subplebbitAddress}-${location.pathname}`;
if (pageNumber === '1') {
return <Navigate to='/not-found' replace />;
}
return (
<div className={styles.boardLayout}>
<BoardsBar />
@@ -180,14 +185,6 @@ const CatalogFeedRoute = () => {
return <Catalog viewType={viewType} boardIdentifier={params.boardIdentifier} />;
};
const PageOneGuard = () => {
const { pageNumber } = useParams();
if (pageNumber === '1') {
return <Navigate to='/not-found' replace />;
}
return null;
};
const ModQueueRoute = () => {
const { boardIdentifier } = useParams();
const account = useAccount();
@@ -244,6 +241,14 @@ const App = () => {
<Route path='/faq' element={<FAQ />} />
<Route path='/rules/:boardIdentifier?' element={<Rules />} />
<Route path='/blotter' element={<Blotter />} />
<Route
path='/settings/account-data'
element={
<Suspense fallback={null}>
<AccountDataEditor />
</Suspense>
}
/>
<Route element={<BoardLayout />}>
{/* Canonical multiboard routes (no time filter) */}
<Route path='/all' element={boardFeedElement} />
@@ -269,7 +274,8 @@ const App = () => {
<Route path='/subs/*' element={<Navigate to='/not-found' replace />} />
<Route path='/mod/*' element={<Navigate to='/not-found' replace />} />
<Route path='/:boardIdentifier/:pageNumber' element={<PageOneGuard />} />
<Route path='/:boardIdentifier/:pageNumber' element={boardFeedElement} />
<Route path='/:boardIdentifier/:pageNumber/settings' element={boardFeedElement} />
<Route path='/:boardIdentifier' element={boardFeedElement} />
<Route path='/:boardIdentifier/settings' element={boardFeedElement} />
<Route path='/:boardIdentifier/catalog' element={catalogFeedElement} />