(root: ShellRoot, pathname: string)
| 42 | // the lit tab from one of these scrolls or refreshes; from anywhere else it |
| 43 | // returns here. |
| 44 | export 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 | |
| 68 | const explorePrefixes = ['/posts', '/search', '/tags', '/sources', '/users']; |
| 69 |
no test coverage detected