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

Function owningRoot

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

Source from the content-addressed store, hash-verified

71// squads; Explore for search and the tag, source and leaderboard
72// directories.
73export const owningRoot = (pathname: string): ShellRoot => {
74 const path = withoutLayoutVariantPrefix(pathname ?? '');
75
76 if (path.startsWith('/squads')) {
77 return ShellRoot.Squads;
78 }
79 if (path.startsWith('/notifications')) {
80 return ShellRoot.Activity;
81 }
82 if (
83 isRootView(ShellRoot.Explore, path) ||
84 exploreLeafPrefixes.some((prefix) => path.startsWith(prefix))
85 ) {
86 return ShellRoot.Explore;
87 }
88 if (path.startsWith('/posts/')) {
89 return ShellRoot.Home;
90 }
91 if (
92 explorePrefixes.some(
93 (prefix) => path === prefix || path.startsWith(`${prefix}/`),
94 )
95 ) {
96 return ShellRoot.Explore;
97 }
98
99 return ShellRoot.Home;
100};
101
102const noClusterPrefixes = [
103 // 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