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

Function pageIconForPath

packages/shared/src/components/sidebar/pageIcons.ts:69–86  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

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.
69export 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};

Callers 2

SidebarEntityIconFunction · 0.90
iconForTypeFunction · 0.90

Calls 1

stripOriginFunction · 0.70

Tested by

no test coverage detected