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

Function isRootView

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

Source from the content-addressed store, hash-verified

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

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