mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
Add board directory view (#1132)
* feat(directory): add board directory view * fix(directory): populate board status * style(directory): tighten board table * docs(board manager): point board owners to manager * fix(directory): show loading status * style(directory): center board column in directory table * perf(directory): cap board status checks * style(directory): simplify board row links * test(ci): stabilize coverage run * test(ci): stabilize coverage harness * test(ci): avoid async app flush act * test(app): narrow layout harness coverage * test(ci): stabilize app update distribution mock * test(ci): preload app harness before route tests * fix(directory): address final review findings
This commit is contained in:
@@ -115,24 +115,33 @@ export const areSameBoardAddress = (a: string | undefined, b: string | undefined
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if an identifier is a directory short code
|
||||
* True when the URL board segment is a directory short code (e.g. /biz), not a full board address (e.g. /board.bso).
|
||||
*/
|
||||
export const isDirectoryBoard = (identifier: string, communities: DirectoryCommunity[]): boolean => {
|
||||
export const isDirectoryRoute = (boardIdentifier: string, communities: DirectoryCommunity[]): boolean => {
|
||||
const directoryToAddress = getDirectoryToAddressMap(communities);
|
||||
return directoryToAddress.has(identifier);
|
||||
return directoryToAddress.has(boardIdentifier);
|
||||
};
|
||||
|
||||
/** @deprecated Use {@link isDirectoryRoute} */
|
||||
export const isDirectoryBoard = isDirectoryRoute;
|
||||
|
||||
export const isArchiveRoute = (pathname: string): boolean => {
|
||||
const normalizedPath = pathname.replace(/\/settings$/, '').replace(/\/$/, '');
|
||||
return normalizedPath.endsWith('/archive');
|
||||
};
|
||||
|
||||
export const isDirectoryListRoute = (pathname: string): boolean => {
|
||||
const normalizedPath = pathname.replace(/\/settings$/, '').replace(/\/$/, '');
|
||||
return normalizedPath.endsWith('/directory');
|
||||
};
|
||||
|
||||
export const isFeedRoute = (pathname: string): boolean => {
|
||||
const normalizedPath = pathname.endsWith('/') ? pathname.slice(0, -1) : pathname;
|
||||
|
||||
if (normalizedPath.includes('/thread/')) return false;
|
||||
if (normalizedPath.startsWith('/pending/')) return false;
|
||||
if (isArchiveRoute(normalizedPath)) return false;
|
||||
if (isDirectoryListRoute(normalizedPath)) return false;
|
||||
if (isBoardModRoute(normalizedPath) || isModQueueRoute(normalizedPath)) return false;
|
||||
|
||||
const pathWithoutSettings = normalizedPath.replace(/\/settings$/, '');
|
||||
@@ -270,7 +279,7 @@ export const getFeedCacheKey = (pathname: string, search = ''): string | null =>
|
||||
return null;
|
||||
}
|
||||
|
||||
if (isArchiveRoute(normalizedPath) || isBoardModRoute(normalizedPath) || isModQueueRoute(normalizedPath)) {
|
||||
if (isArchiveRoute(normalizedPath) || isDirectoryListRoute(normalizedPath) || isBoardModRoute(normalizedPath) || isModQueueRoute(normalizedPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user