feat: add Multiboards category with /subs/ and /all/

This commit is contained in:
plebeius
2025-11-12 16:35:38 +01:00
parent af1468669c
commit 12101fe75e
9 changed files with 48 additions and 34 deletions
+4 -4
View File
@@ -148,10 +148,10 @@ const App = () => (
<Route path='/all/catalog/:timeFilterName?' element={<Catalog />} />
<Route path='/all/catalog/:timeFilterName?/settings' element={<Catalog />} />
<Route path='/subscriptions/:timeFilterName?' element={<Board />} />
<Route path='/subscriptions/:timeFilterName?/settings' element={<Board />} />
<Route path='/subscriptions/catalog/:timeFilterName?' element={<Catalog />} />
<Route path='/subscriptions/catalog/:timeFilterName?/settings' element={<Catalog />} />
<Route path='/subs/:timeFilterName?' element={<Board />} />
<Route path='/subs/:timeFilterName?/settings' element={<Board />} />
<Route path='/subs/catalog/:timeFilterName?' element={<Catalog />} />
<Route path='/subs/catalog/:timeFilterName?/settings' element={<Catalog />} />
<Route path='/mod/:timeFilterName?' element={<Board />} />
<Route path='/mod/:timeFilterName?/settings' element={<Board />} />
@@ -39,8 +39,8 @@ const CatalogButton = ({ address, isInAllView, isInSubscriptionsView, isInModVie
if (params?.timeFilterName) return `/all/catalog/${params.timeFilterName}`;
return `/all/catalog`;
} else if (isInSubscriptionsView) {
if (params?.timeFilterName) return `/subscriptions/catalog/${params.timeFilterName}`;
return `/subscriptions/catalog`;
if (params?.timeFilterName) return `/subs/catalog/${params.timeFilterName}`;
return `/subs/catalog`;
} else if (isInModView) {
if (params?.timeFilterName) return `/mod/catalog/${params.timeFilterName}`;
return `/mod/catalog`;
@@ -82,8 +82,8 @@ const ReturnButton = ({ address, isInAllView, isInSubscriptionsView, isInModView
if (params?.timeFilterName) return `/all/${params.timeFilterName}`;
return `/all`;
} else if (isInSubscriptionsView) {
if (params?.timeFilterName) return `/subscriptions/${params.timeFilterName}`;
return `/subscriptions`;
if (params?.timeFilterName) return `/subs/${params.timeFilterName}`;
return `/subs`;
} else if (isInModView) {
if (params?.timeFilterName) return `/mod/${params.timeFilterName}`;
return `/mod`;
@@ -249,8 +249,8 @@ export const TimeFilter = ({ isInAllView, isInCatalogView, isInSubscriptionsView
: `/all/${timeFilterName}`
: isInSubscriptionsView
? isInCatalogView
? `/subscriptions/catalog/${timeFilterName}`
: `/subscriptions/${timeFilterName}`
? `/subs/catalog/${timeFilterName}`
: `/subs/${timeFilterName}`
: isInModView
? isInCatalogView
? `/mod/catalog/${timeFilterName}`
@@ -507,8 +507,8 @@ const SearchOPsBar = () => {
: `/all/catalog?q=${encodeURIComponent(searchQuery)}`;
} else if (isInSubscriptionsView) {
catalogUrl = params?.timeFilterName
? `/subscriptions/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
: `/subscriptions/catalog?q=${encodeURIComponent(searchQuery)}`;
? `/subs/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
: `/subs/catalog?q=${encodeURIComponent(searchQuery)}`;
} else if (isInModView) {
catalogUrl = params?.timeFilterName
? `/mod/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
+3 -3
View File
@@ -43,13 +43,13 @@ const BoardHeader = () => {
const defaultSubplebbit = subplebbitAddress ? defaultSubplebbits.find((s) => s.address === subplebbitAddress) : null;
const title = isInAllView
? multisubMetadata?.title || 'all'
? multisubMetadata?.title || '/all/ - 5chan Directories'
: isInSubscriptionsView
? 'Subscriptions'
? '/subs/ - Subscriptions'
: isInModView
? _.startCase(t('boards_you_moderate'))
: defaultSubplebbit?.title || subplebbit?.title;
const subtitle = isInAllView ? 'p/all' : isInSubscriptionsView ? 'p/subscriptions' : isInModView ? 'p/mod' : `p/${address || subplebbitAddress || ''}`;
const subtitle = isInAllView ? '/all/' : isInSubscriptionsView ? '/subs/' : isInModView ? '/mod/' : `${address || subplebbitAddress || ''}`;
const { isOffline, isOnlineStatusLoading, offlineIconClass, offlineTitle } = useIsSubplebbitOffline(subplebbit);
+1 -1
View File
@@ -179,7 +179,7 @@ const TopBarDesktop = () => {
return (
<div className={styles.boardNavDesktop}>
<span className={styles.boardList}>
[<Link to='/all'>all</Link> / <Link to='/subscriptions'>subscriptions</Link>
[<Link to='/all'>all</Link> / <Link to='/subs'>subs</Link>
{accountSubplebbitAddresses.length > 0 && (
<>
{' '}
+1 -1
View File
@@ -59,7 +59,7 @@ export const is5chanLink = (url: string): boolean => {
// - /{boardIdentifier}/catalog
// - /{boardIdentifier}/description
// - /{boardIdentifier}/rules
// - /all, /subscriptions, /mod, /pending/{index}
// - /all, /subs, /mod, /pending/{index}
return (
/^\/p\/[^/]+(\/c\/[^/]+)?$/.test(routePath) ||
/^\/[^/]+(\/thread\/[^/]+|\/catalog|\/description|\/rules)?$/.test(routePath) ||
+13 -13
View File
@@ -16,7 +16,7 @@ export const isBoardView = (pathname: string, params: ParamsType): boolean => {
// Check if it's a board view (not all, subscriptions, mod, pending, or special routes)
if (
pathname.startsWith('/all') ||
pathname.startsWith('/subscriptions') ||
pathname.startsWith('/subs') ||
pathname.startsWith('/mod') ||
pathname.startsWith('/pending') ||
pathname === '/' ||
@@ -40,10 +40,10 @@ export const isCatalogView = (pathname: string, params: ParamsType): boolean =>
decodedPathname === `/all/catalog/settings` ||
decodedPathname === `/all/catalog/${timeFilterName}` ||
decodedPathname === `/all/catalog/${timeFilterName}/settings` ||
decodedPathname === `/subscriptions/catalog` ||
decodedPathname === `/subscriptions/catalog/settings` ||
decodedPathname === `/subscriptions/catalog/${timeFilterName}` ||
decodedPathname === `/subscriptions/catalog/${timeFilterName}/settings` ||
decodedPathname === `/subs/catalog` ||
decodedPathname === `/subs/catalog/settings` ||
decodedPathname === `/subs/catalog/${timeFilterName}` ||
decodedPathname === `/subs/catalog/${timeFilterName}/settings` ||
decodedPathname === `/mod/catalog` ||
decodedPathname === `/mod/catalog/settings` ||
decodedPathname === `/mod/catalog/${timeFilterName}` ||
@@ -99,14 +99,14 @@ export const isSettingsView = (pathname: string, params: ParamsType): boolean =>
export const isSubscriptionsView = (pathname: string, params: ParamsType): boolean => {
const { timeFilterName } = params;
return (
pathname === '/subscriptions' ||
pathname === '/subscriptions/settings' ||
pathname === `/subscriptions/${timeFilterName}` ||
pathname === `/subscriptions/${timeFilterName}/settings` ||
pathname === '/subscriptions/catalog' ||
pathname === '/subscriptions/catalog/settings' ||
pathname === `/subscriptions/catalog/${timeFilterName}` ||
pathname === `/subscriptions/catalog/${timeFilterName}/settings`
pathname === '/subs' ||
pathname === '/subs/settings' ||
pathname === `/subs/${timeFilterName}` ||
pathname === `/subs/${timeFilterName}/settings` ||
pathname === '/subs/catalog' ||
pathname === '/subs/catalog/settings' ||
pathname === `/subs/catalog/${timeFilterName}` ||
pathname === `/subs/catalog/${timeFilterName}/settings`
);
};
+1 -1
View File
@@ -200,7 +200,7 @@ const Board = () => {
showMorePostsSuggestion &&
(monthlyFeed.length > feed.length || yearlyFeed.length > monthlyFeed.length) &&
(() => {
const basePath = isInAllView ? '/all' : isInSubscriptionsView ? '/subscriptions' : isInModView ? '/mod' : boardPath ? `/${boardPath}` : '';
const basePath = isInAllView ? '/all' : isInSubscriptionsView ? '/subs' : isInModView ? '/mod' : boardPath ? `/${boardPath}` : '';
return weeklyFeed.length > feed.length ? (
<div className={styles.morePostsSuggestion}>
<Trans
+3 -3
View File
@@ -378,7 +378,7 @@ const Catalog = () => {
i18nKey='more_threads_last_week'
values={{ currentTimeFilterName, count: feed.length }}
components={{
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subscriptions/catalog' : `/${boardPath}/catalog`) + '/1w'} />,
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1w'} />,
}}
/>
</div>
@@ -388,7 +388,7 @@ const Catalog = () => {
i18nKey='more_threads_last_month'
values={{ currentTimeFilterName, count: feed.length }}
components={{
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subscriptions/catalog' : `/${boardPath}/catalog`) + '/1m'} />,
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1m'} />,
}}
/>
</div>
@@ -398,7 +398,7 @@ const Catalog = () => {
i18nKey='more_threads_last_year'
values={{ currentTimeFilterName, count: feed.length }}
components={{
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subscriptions/catalog' : `/${boardPath}/catalog`) + '/1y'} />,
1: <Link to={(isInAllView ? '/all/catalog' : isInSubscriptionsView ? '/subs/catalog' : `/${boardPath}/catalog`) + '/1y'} />,
}}
/>
</div>
@@ -603,6 +603,20 @@ const BoardsList = ({ multisub }: { multisub: MultisubSubplebbit[] }) => {
</ul>
</div>
)}
{/* Column 6: Meta */}
<div className={styles.boardsColumn}>
<h3>Multiboards</h3>
<NSFWBadge />
<ul>
<li>
<Link to='/all'>All 5chan Directories</Link>
</li>
<li>
<Link to='/subs'>Subscriptions</Link>
</li>
</ul>
</div>
</div>
</div>
);