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

Function typeForPathname

packages/shared/src/hooks/useRecentPages.ts:23–37  ·  view source on GitHub ↗
(pathname: string)

Source from the content-addressed store, hash-verified

21// the template distinguishes a user profile (`/[userId]`) from other top-level
22// pages like `/jobs`.
23const typeForPathname = (pathname: string): RecentPageType => {
24 if (pathname === '/[userId]') {
25 return 'user';
26 }
27 if (pathname.startsWith('/sources/')) {
28 return 'source';
29 }
30 if (pathname.startsWith('/squads/')) {
31 return 'squad';
32 }
33 if (pathname.startsWith('/tags/')) {
34 return 'tag';
35 }
36 return 'page';
37};
38
39// Records the last visited non-post pages for the v2 Home "Recent" section.
40// Individual post permalinks (`/posts/[id]`) are skipped — those belong to

Callers 1

captureFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected