fix(settings): decode subplebbit address with emoji to fix pathname

This commit is contained in:
Tom (plebeius.eth)
2024-05-31 19:59:08 +02:00
parent 1ecb2ba13d
commit 2ecedcc956
2 changed files with 13 additions and 6 deletions
+10
View File
@@ -44,6 +44,16 @@ export const isRulesView = (pathname: string, params: ParamsType): boolean => {
return params.subplebbitAddress ? decodedPathname.startsWith(`/p/${params.subplebbitAddress}/rules`) : false;
};
export const isSettingsView = (pathname: string, params: ParamsType): boolean => {
const { subplebbitAddress, commentCid } = params;
const decodedPathname = decodeURIComponent(pathname);
return (
decodedPathname === `/p/${subplebbitAddress}/c/${commentCid}/settings` ||
decodedPathname === `/p/${subplebbitAddress}/description/settings` ||
decodedPathname === `/p/${subplebbitAddress}/rules/settings`
);
};
export const isSubscriptionsView = (pathname: string): boolean => {
return pathname.startsWith('/p/subscriptions');
};