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

Function typeForPathname

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

Source from the content-addressed store, hash-verified

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