feat(board): add p/all and p/subscriptions

This commit is contained in:
plebeius.eth
2024-05-17 14:54:41 +02:00
parent 50df786a86
commit 86223bb249
4 changed files with 72 additions and 28 deletions
+22 -14
View File
@@ -4,8 +4,13 @@ export type ParamsType = {
subplebbitAddress?: string;
};
export const isHomeView = (pathname: string): boolean => {
return pathname === '/';
export const isAllView = (pathname: string): boolean => {
return pathname === '/p/all';
};
export const isCatalogView = (pathname: string, params: ParamsType): boolean => {
const decodedPathname = decodeURIComponent(pathname);
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/catalog`) : false;
};
export const isDescriptionView = (pathname: string, params: ParamsType): boolean => {
@@ -13,9 +18,12 @@ export const isDescriptionView = (pathname: string, params: ParamsType): boolean
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/description`) : false;
};
export const isRulesView = (pathname: string, params: ParamsType): boolean => {
const decodedPathname = decodeURIComponent(pathname);
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/rules`) : false;
export const isHomeView = (pathname: string): boolean => {
return pathname === '/';
};
export const isPendingPostView = (pathname: string, params: ParamsType): boolean => {
return pathname === `/profile/${params.accountCommentIndex}`;
};
export const isPostPageView = (pathname: string, params: ParamsType): boolean => {
@@ -26,22 +34,22 @@ export const isPostPageView = (pathname: string, params: ParamsType): boolean =>
return params.subplebbitAddress && params.commentCid ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/c/${params.commentCid}`) : false;
};
export const isCatalogView = (pathname: string, params: ParamsType): boolean => {
export const isRulesView = (pathname: string, params: ParamsType): boolean => {
const decodedPathname = decodeURIComponent(pathname);
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/catalog`) : false;
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/rules`) : false;
};
export const isPendingPostView = (pathname: string, params: ParamsType): boolean => {
return pathname === `/profile/${params.accountCommentIndex}`;
export const isSubscriptionsView = (pathname: string): boolean => {
return pathname === '/p/subscriptions';
};
export const isNotFoundView = (pathname: string, params: ParamsType): boolean => {
return (
!isHomeView(pathname) &&
!isDescriptionView(pathname, params) &&
!isRulesView(pathname, params) &&
!isPostPageView(pathname, params) &&
!isCatalogView(pathname, params) &&
!isPendingPostView(pathname, params)
!isDescriptionView(pathname, params) &&
!isHomeView(pathname) &&
!isPendingPostView(pathname, params) &&
!isPostPageView(pathname, params) &&
!isRulesView(pathname, params)
);
};