mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
feat: add Multiboards category with /subs/ and /all/
This commit is contained in:
+4
-4
@@ -148,10 +148,10 @@ const App = () => (
|
|||||||
<Route path='/all/catalog/:timeFilterName?' element={<Catalog />} />
|
<Route path='/all/catalog/:timeFilterName?' element={<Catalog />} />
|
||||||
<Route path='/all/catalog/:timeFilterName?/settings' element={<Catalog />} />
|
<Route path='/all/catalog/:timeFilterName?/settings' element={<Catalog />} />
|
||||||
|
|
||||||
<Route path='/subscriptions/:timeFilterName?' element={<Board />} />
|
<Route path='/subs/:timeFilterName?' element={<Board />} />
|
||||||
<Route path='/subscriptions/:timeFilterName?/settings' element={<Board />} />
|
<Route path='/subs/:timeFilterName?/settings' element={<Board />} />
|
||||||
<Route path='/subscriptions/catalog/:timeFilterName?' element={<Catalog />} />
|
<Route path='/subs/catalog/:timeFilterName?' element={<Catalog />} />
|
||||||
<Route path='/subscriptions/catalog/:timeFilterName?/settings' element={<Catalog />} />
|
<Route path='/subs/catalog/:timeFilterName?/settings' element={<Catalog />} />
|
||||||
|
|
||||||
<Route path='/mod/:timeFilterName?' element={<Board />} />
|
<Route path='/mod/:timeFilterName?' element={<Board />} />
|
||||||
<Route path='/mod/:timeFilterName?/settings' 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}`;
|
if (params?.timeFilterName) return `/all/catalog/${params.timeFilterName}`;
|
||||||
return `/all/catalog`;
|
return `/all/catalog`;
|
||||||
} else if (isInSubscriptionsView) {
|
} else if (isInSubscriptionsView) {
|
||||||
if (params?.timeFilterName) return `/subscriptions/catalog/${params.timeFilterName}`;
|
if (params?.timeFilterName) return `/subs/catalog/${params.timeFilterName}`;
|
||||||
return `/subscriptions/catalog`;
|
return `/subs/catalog`;
|
||||||
} else if (isInModView) {
|
} else if (isInModView) {
|
||||||
if (params?.timeFilterName) return `/mod/catalog/${params.timeFilterName}`;
|
if (params?.timeFilterName) return `/mod/catalog/${params.timeFilterName}`;
|
||||||
return `/mod/catalog`;
|
return `/mod/catalog`;
|
||||||
@@ -82,8 +82,8 @@ const ReturnButton = ({ address, isInAllView, isInSubscriptionsView, isInModView
|
|||||||
if (params?.timeFilterName) return `/all/${params.timeFilterName}`;
|
if (params?.timeFilterName) return `/all/${params.timeFilterName}`;
|
||||||
return `/all`;
|
return `/all`;
|
||||||
} else if (isInSubscriptionsView) {
|
} else if (isInSubscriptionsView) {
|
||||||
if (params?.timeFilterName) return `/subscriptions/${params.timeFilterName}`;
|
if (params?.timeFilterName) return `/subs/${params.timeFilterName}`;
|
||||||
return `/subscriptions`;
|
return `/subs`;
|
||||||
} else if (isInModView) {
|
} else if (isInModView) {
|
||||||
if (params?.timeFilterName) return `/mod/${params.timeFilterName}`;
|
if (params?.timeFilterName) return `/mod/${params.timeFilterName}`;
|
||||||
return `/mod`;
|
return `/mod`;
|
||||||
@@ -249,8 +249,8 @@ export const TimeFilter = ({ isInAllView, isInCatalogView, isInSubscriptionsView
|
|||||||
: `/all/${timeFilterName}`
|
: `/all/${timeFilterName}`
|
||||||
: isInSubscriptionsView
|
: isInSubscriptionsView
|
||||||
? isInCatalogView
|
? isInCatalogView
|
||||||
? `/subscriptions/catalog/${timeFilterName}`
|
? `/subs/catalog/${timeFilterName}`
|
||||||
: `/subscriptions/${timeFilterName}`
|
: `/subs/${timeFilterName}`
|
||||||
: isInModView
|
: isInModView
|
||||||
? isInCatalogView
|
? isInCatalogView
|
||||||
? `/mod/catalog/${timeFilterName}`
|
? `/mod/catalog/${timeFilterName}`
|
||||||
@@ -507,8 +507,8 @@ const SearchOPsBar = () => {
|
|||||||
: `/all/catalog?q=${encodeURIComponent(searchQuery)}`;
|
: `/all/catalog?q=${encodeURIComponent(searchQuery)}`;
|
||||||
} else if (isInSubscriptionsView) {
|
} else if (isInSubscriptionsView) {
|
||||||
catalogUrl = params?.timeFilterName
|
catalogUrl = params?.timeFilterName
|
||||||
? `/subscriptions/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
|
? `/subs/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
|
||||||
: `/subscriptions/catalog?q=${encodeURIComponent(searchQuery)}`;
|
: `/subs/catalog?q=${encodeURIComponent(searchQuery)}`;
|
||||||
} else if (isInModView) {
|
} else if (isInModView) {
|
||||||
catalogUrl = params?.timeFilterName
|
catalogUrl = params?.timeFilterName
|
||||||
? `/mod/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
|
? `/mod/catalog/${params.timeFilterName}?q=${encodeURIComponent(searchQuery)}`
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ const BoardHeader = () => {
|
|||||||
const defaultSubplebbit = subplebbitAddress ? defaultSubplebbits.find((s) => s.address === subplebbitAddress) : null;
|
const defaultSubplebbit = subplebbitAddress ? defaultSubplebbits.find((s) => s.address === subplebbitAddress) : null;
|
||||||
|
|
||||||
const title = isInAllView
|
const title = isInAllView
|
||||||
? multisubMetadata?.title || 'all'
|
? multisubMetadata?.title || '/all/ - 5chan Directories'
|
||||||
: isInSubscriptionsView
|
: isInSubscriptionsView
|
||||||
? 'Subscriptions'
|
? '/subs/ - Subscriptions'
|
||||||
: isInModView
|
: isInModView
|
||||||
? _.startCase(t('boards_you_moderate'))
|
? _.startCase(t('boards_you_moderate'))
|
||||||
: defaultSubplebbit?.title || subplebbit?.title;
|
: 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);
|
const { isOffline, isOnlineStatusLoading, offlineIconClass, offlineTitle } = useIsSubplebbitOffline(subplebbit);
|
||||||
|
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ const TopBarDesktop = () => {
|
|||||||
return (
|
return (
|
||||||
<div className={styles.boardNavDesktop}>
|
<div className={styles.boardNavDesktop}>
|
||||||
<span className={styles.boardList}>
|
<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 && (
|
{accountSubplebbitAddresses.length > 0 && (
|
||||||
<>
|
<>
|
||||||
{' '}
|
{' '}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ export const is5chanLink = (url: string): boolean => {
|
|||||||
// - /{boardIdentifier}/catalog
|
// - /{boardIdentifier}/catalog
|
||||||
// - /{boardIdentifier}/description
|
// - /{boardIdentifier}/description
|
||||||
// - /{boardIdentifier}/rules
|
// - /{boardIdentifier}/rules
|
||||||
// - /all, /subscriptions, /mod, /pending/{index}
|
// - /all, /subs, /mod, /pending/{index}
|
||||||
return (
|
return (
|
||||||
/^\/p\/[^/]+(\/c\/[^/]+)?$/.test(routePath) ||
|
/^\/p\/[^/]+(\/c\/[^/]+)?$/.test(routePath) ||
|
||||||
/^\/[^/]+(\/thread\/[^/]+|\/catalog|\/description|\/rules)?$/.test(routePath) ||
|
/^\/[^/]+(\/thread\/[^/]+|\/catalog|\/description|\/rules)?$/.test(routePath) ||
|
||||||
|
|||||||
+13
-13
@@ -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)
|
// Check if it's a board view (not all, subscriptions, mod, pending, or special routes)
|
||||||
if (
|
if (
|
||||||
pathname.startsWith('/all') ||
|
pathname.startsWith('/all') ||
|
||||||
pathname.startsWith('/subscriptions') ||
|
pathname.startsWith('/subs') ||
|
||||||
pathname.startsWith('/mod') ||
|
pathname.startsWith('/mod') ||
|
||||||
pathname.startsWith('/pending') ||
|
pathname.startsWith('/pending') ||
|
||||||
pathname === '/' ||
|
pathname === '/' ||
|
||||||
@@ -40,10 +40,10 @@ export const isCatalogView = (pathname: string, params: ParamsType): boolean =>
|
|||||||
decodedPathname === `/all/catalog/settings` ||
|
decodedPathname === `/all/catalog/settings` ||
|
||||||
decodedPathname === `/all/catalog/${timeFilterName}` ||
|
decodedPathname === `/all/catalog/${timeFilterName}` ||
|
||||||
decodedPathname === `/all/catalog/${timeFilterName}/settings` ||
|
decodedPathname === `/all/catalog/${timeFilterName}/settings` ||
|
||||||
decodedPathname === `/subscriptions/catalog` ||
|
decodedPathname === `/subs/catalog` ||
|
||||||
decodedPathname === `/subscriptions/catalog/settings` ||
|
decodedPathname === `/subs/catalog/settings` ||
|
||||||
decodedPathname === `/subscriptions/catalog/${timeFilterName}` ||
|
decodedPathname === `/subs/catalog/${timeFilterName}` ||
|
||||||
decodedPathname === `/subscriptions/catalog/${timeFilterName}/settings` ||
|
decodedPathname === `/subs/catalog/${timeFilterName}/settings` ||
|
||||||
decodedPathname === `/mod/catalog` ||
|
decodedPathname === `/mod/catalog` ||
|
||||||
decodedPathname === `/mod/catalog/settings` ||
|
decodedPathname === `/mod/catalog/settings` ||
|
||||||
decodedPathname === `/mod/catalog/${timeFilterName}` ||
|
decodedPathname === `/mod/catalog/${timeFilterName}` ||
|
||||||
@@ -99,14 +99,14 @@ export const isSettingsView = (pathname: string, params: ParamsType): boolean =>
|
|||||||
export const isSubscriptionsView = (pathname: string, params: ParamsType): boolean => {
|
export const isSubscriptionsView = (pathname: string, params: ParamsType): boolean => {
|
||||||
const { timeFilterName } = params;
|
const { timeFilterName } = params;
|
||||||
return (
|
return (
|
||||||
pathname === '/subscriptions' ||
|
pathname === '/subs' ||
|
||||||
pathname === '/subscriptions/settings' ||
|
pathname === '/subs/settings' ||
|
||||||
pathname === `/subscriptions/${timeFilterName}` ||
|
pathname === `/subs/${timeFilterName}` ||
|
||||||
pathname === `/subscriptions/${timeFilterName}/settings` ||
|
pathname === `/subs/${timeFilterName}/settings` ||
|
||||||
pathname === '/subscriptions/catalog' ||
|
pathname === '/subs/catalog' ||
|
||||||
pathname === '/subscriptions/catalog/settings' ||
|
pathname === '/subs/catalog/settings' ||
|
||||||
pathname === `/subscriptions/catalog/${timeFilterName}` ||
|
pathname === `/subs/catalog/${timeFilterName}` ||
|
||||||
pathname === `/subscriptions/catalog/${timeFilterName}/settings`
|
pathname === `/subs/catalog/${timeFilterName}/settings`
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ const Board = () => {
|
|||||||
showMorePostsSuggestion &&
|
showMorePostsSuggestion &&
|
||||||
(monthlyFeed.length > feed.length || yearlyFeed.length > monthlyFeed.length) &&
|
(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 ? (
|
return weeklyFeed.length > feed.length ? (
|
||||||
<div className={styles.morePostsSuggestion}>
|
<div className={styles.morePostsSuggestion}>
|
||||||
<Trans
|
<Trans
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ const Catalog = () => {
|
|||||||
i18nKey='more_threads_last_week'
|
i18nKey='more_threads_last_week'
|
||||||
values={{ currentTimeFilterName, count: feed.length }}
|
values={{ currentTimeFilterName, count: feed.length }}
|
||||||
components={{
|
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>
|
</div>
|
||||||
@@ -388,7 +388,7 @@ const Catalog = () => {
|
|||||||
i18nKey='more_threads_last_month'
|
i18nKey='more_threads_last_month'
|
||||||
values={{ currentTimeFilterName, count: feed.length }}
|
values={{ currentTimeFilterName, count: feed.length }}
|
||||||
components={{
|
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>
|
</div>
|
||||||
@@ -398,7 +398,7 @@ const Catalog = () => {
|
|||||||
i18nKey='more_threads_last_year'
|
i18nKey='more_threads_last_year'
|
||||||
values={{ currentTimeFilterName, count: feed.length }}
|
values={{ currentTimeFilterName, count: feed.length }}
|
||||||
components={{
|
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>
|
</div>
|
||||||
|
|||||||
@@ -603,6 +603,20 @@ const BoardsList = ({ multisub }: { multisub: MultisubSubplebbit[] }) => {
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</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>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user