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

Function getFeedName

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

Source from the content-addressed store, hash-verified

245export const defaultFeedConditions = [null, 'default', '/', ''];
246
247export const getFeedName = (
248 path: string,
249 options: GetDefaultFeedProps = {},
250): AllFeedPages => {
251 const feed = path?.replaceAll?.('/', '') || '';
252
253 if (defaultFeedConditions.some((condition) => condition === feed)) {
254 return getDefaultFeed(options);
255 }
256 if (feed.startsWith('search')) {
257 return SharedFeedPage.Search;
258 }
259 if (feed === '[userId]upvoted') {
260 return OtherFeedPage.UserUpvoted;
261 }
262 if (feed === '[userId]posts') {
263 return OtherFeedPage.UserPosts;
264 }
265 if (feed.startsWith('feeds')) {
266 const isMyFeedEdit =
267 ['edit'].some((item) => feed.endsWith(item)) && options.isMyFeed;
268
269 return isMyFeedEdit ? SharedFeedPage.MyFeed : SharedFeedPage.Custom;
270 }
271
272 const [page] = feed.split('?');
273
274 return page.replace(/^\/+/, '') as SharedFeedPage;
275};
276
277export type FeedAdTemplate = {
278 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