(path: string)
| 67 | // The glyph component for a known app page, or null when the path isn't one — |
| 68 | // callers own the size/active props and their own fallback. |
| 69 | export const pageIconForPath = (path: string): SidebarPageIcon | null => { |
| 70 | const withQuery = stripOrigin(path); |
| 71 | // Query-bearing destinations are matched before the query is dropped, or a |
| 72 | // modal launcher resolves as whatever page it sits on top of. |
| 73 | const launcher = EXACT_PAGE_ICONS[withQuery]; |
| 74 | if (launcher) { |
| 75 | return launcher; |
| 76 | } |
| 77 | const normalized = withQuery.split('?')[0].split('#')[0]; |
| 78 | const exact = EXACT_PAGE_ICONS[normalized]; |
| 79 | if (exact) { |
| 80 | return exact; |
| 81 | } |
| 82 | const prefixed = PREFIX_PAGE_ICONS.find( |
| 83 | ([prefix]) => normalized === prefix || normalized.startsWith(`${prefix}/`), |
| 84 | ); |
| 85 | return prefixed?.[1] ?? null; |
| 86 | }; |
no test coverage detected