MCPcopy Create free account
hub / github.com/dailydotdev/apps / isRootView

Function isRootView

packages/shared/src/components/shell/shellNav.ts:43–65  ·  view source on GitHub ↗
(root: ShellRoot, pathname: string)

Source from the content-addressed store, hash-verified

41// the lit tab from one of these scrolls or refreshes; from anywhere else it
42// returns here.
43export const isRootView = (root: ShellRoot, pathname: string): boolean => {
44 const path = withoutLayoutVariantPrefix(pathname ?? '');
45
46 switch (root) {
47 case ShellRoot.Home:
48 return (
49 homeViews.includes(path) ||
50 path.startsWith('/highlights') ||
51 (path.startsWith('/feeds/[slugOrId]') && !path.endsWith('/edit'))
52 );
53 case ShellRoot.Explore:
54 return (
55 exploreViews.includes(path) ||
56 exploreSortPrefixes.some((prefix) => path.startsWith(prefix))
57 );
58 case ShellRoot.Squads:
59 return path.startsWith(squadCategoriesPaths.discover);
60 case ShellRoot.Activity:
61 return path === '/notifications';
62 default:
63 return false;
64 }
65};
66
67const explorePrefixes = ['/posts', '/search', '/tags', '/sources', '/users'];
68

Callers 8

MainFeedLayoutFunction · 0.90
ShellClusterFunction · 0.90
activateFunction · 0.90
shellNav.spec.tsFile · 0.90
useShellBlockPlanFunction · 0.90
pageLinkFunction · 0.90
useNativeBridgeFunction · 0.90
owningRootFunction · 0.85

Calls 1

Tested by

no test coverage detected