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

Function getFeedName

packages/shared/src/lib/feed.ts:280–308  ·  view source on GitHub ↗
(
  path: string,
  options: GetDefaultFeedProps = {},
)

Source from the content-addressed store, hash-verified

278export const defaultFeedConditions = [null, 'default', '/', ''];
279
280export const getFeedName = (
281 path: string,
282 options: GetDefaultFeedProps = {},
283): AllFeedPages => {
284 const feed = path?.replaceAll?.('/', '') || '';
285
286 if (defaultFeedConditions.some((condition) => condition === feed)) {
287 return getDefaultFeed(options);
288 }
289 if (feed.startsWith('search')) {
290 return SharedFeedPage.Search;
291 }
292 if (feed === '[userId]upvoted') {
293 return OtherFeedPage.UserUpvoted;
294 }
295 if (feed === '[userId]posts') {
296 return OtherFeedPage.UserPosts;
297 }
298 if (feed.startsWith('feeds')) {
299 const isMyFeedEdit =
300 ['edit'].some((item) => feed.endsWith(item)) && options.isMyFeed;
301
302 return isMyFeedEdit ? SharedFeedPage.MyFeed : SharedFeedPage.Custom;
303 }
304
305 const [page] = feed.split('?');
306
307 return page.replace(/^\/+/, '') as SharedFeedPage;
308};
309
310export type FeedAdTemplate = {
311 adStart: number;

Callers 6

MainFeedLayoutFunction · 0.90
SidebarTabletFunction · 0.90
FeedExploreHeaderFunction · 0.90
getInternalFeedNameFunction · 0.90
MobileFooterNavbarFunction · 0.90

Calls 2

getDefaultFeedFunction · 0.85
replaceMethod · 0.80

Tested by

no test coverage detected