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

Function typeForPathname

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

Source from the content-addressed store, hash-verified

43// the template distinguishes a user profile (`/[userId]`) from other top-level
44// pages like `/jobs`.
45const typeForPathname = (pathname: string): RecentPageType => {
46 if (pathname === '/[userId]') {
47 return 'user';
48 }
49 if (pathname.startsWith('/sources/')) {
50 return 'source';
51 }
52 if (pathname.startsWith('/squads/')) {
53 return 'squad';
54 }
55 if (pathname.startsWith('/tags/')) {
56 return 'tag';
57 }
58 return 'page';
59};
60
61// Records the last visited non-post pages for the v2 Home "Recent" section.
62// 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