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

Function owningRoot

packages/shared/src/components/shell/shellNav.ts:74–101  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

72// squads; Explore for search and the tag, source and leaderboard
73// directories.
74export const owningRoot = (pathname: string): ShellRoot => {
75 const path = withoutLayoutVariantPrefix(pathname ?? '');
76
77 if (path.startsWith('/squads')) {
78 return ShellRoot.Squads;
79 }
80 if (path.startsWith('/notifications')) {
81 return ShellRoot.Activity;
82 }
83 if (
84 isRootView(ShellRoot.Explore, path) ||
85 exploreLeafPrefixes.some((prefix) => path.startsWith(prefix))
86 ) {
87 return ShellRoot.Explore;
88 }
89 if (path.startsWith('/posts/')) {
90 return ShellRoot.Home;
91 }
92 if (
93 explorePrefixes.some(
94 (prefix) => path === prefix || path.startsWith(`${prefix}/`),
95 )
96 ) {
97 return ShellRoot.Explore;
98 }
99
100 return ShellRoot.Home;
101};
102
103const noClusterPrefixes = [
104 // You is a menu, not a place to browse from; back is its one way out.

Callers 5

ShellClusterFunction · 0.90
shellNav.spec.tsFile · 0.90
pageLinkFunction · 0.90
useNativeBridgeFunction · 0.90
useShellBackFunction · 0.85

Calls 2

isRootViewFunction · 0.85

Tested by

no test coverage detected