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

Function FeedNav

packages/shared/src/components/feeds/FeedNav.tsx:66–274  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64);
65
66function FeedNav(): ReactElement | null {
67 const router = useRouter();
68 const { feedName: rawFeedName } = useActiveFeedNameContext();
69 const feedName = rawFeedName as AllFeedPages;
70 const { sortingEnabled } = useSettingsContext();
71 const { isSortableFeed } = useFeedName({ feedName });
72 const { home, bookmarks } = useActiveNav(feedName);
73 const isMobile = useViewSize(ViewSize.MobileL);
74 const isBelowLaptop = !useViewSize(ViewSize.Laptop);
75 // The notifications bell only belongs to the tablet feed header: phones get it
76 // from the footer nav and laptop+ from the app header. JS-gated (not CSS) so
77 // it never mounts alongside those placements.
78 const isTablet = isBelowLaptop && !isMobile;
79 const { value: feedChipsVariant } = useConditionalFeature({
80 feature: featureFeedChips,
81 shouldEvaluate: isBelowLaptop,
82 });
83 const isFeedChipsEnabled = feedChipsVariant !== FeedChipsVariant.None;
84 const [selectedAlgo, setSelectedAlgo] = usePersistentContext(
85 DEFAULT_ALGORITHM_KEY,
86 DEFAULT_ALGORITHM_INDEX,
87 [0, 1],
88 DEFAULT_ALGORITHM_INDEX,
89 );
90 const featureTheme = useFeatureTheme();
91 const scrollClassName = useScrollTopClassName({ enabled: !!featureTheme });
92 const { feeds } = useFeeds();
93 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
94 const sortedFeeds = useSortedFeeds({ edges: feeds?.edges });
95 const isForYouTab =
96 router.pathname === webappUrl || router.pathname === `${webappUrl}my-feed`;
97 const { plusEntryForYou } = usePlusEntry();
98 const showFeedActions =
99 isMobile &&
100 ((sortingEnabled && isSortableFeed) || feedName === SharedFeedPage.Custom);
101 const shouldRenderFeedChips = isBelowLaptop && isFeedChipsEnabled;
102
103 const renderFeedActions = (iconOnly?: boolean) => (
104 <>
105 {sortingEnabled && isSortableFeed && (
106 <Dropdown
107 className={{
108 label: 'hidden',
109 chevron: 'hidden',
110 button: '!px-1',
111 }}
112 shouldIndicateSelected
113 buttonSize={ButtonSize.Small}
114 buttonVariant={ButtonVariant.Tertiary}
115 icon={<SortIcon />}
116 iconOnly
117 selectedIndex={selectedAlgo}
118 options={algorithmsList}
119 onChange={(_, index) => setSelectedAlgo(index)}
120 drawerProps={{ displayCloseButton: true }}
121 />
122 )}
123

Callers

nothing calls this directly

Calls 15

useActiveFeedNameContextFunction · 0.90
useSettingsContextFunction · 0.90
useFeedNameFunction · 0.90
useViewSizeFunction · 0.90
useConditionalFeatureFunction · 0.90
useFeatureThemeFunction · 0.90
useScrollTopClassNameFunction · 0.90
useFeedsFunction · 0.90
useSortedFeedsFunction · 0.90
useActiveNavFunction · 0.85
usePersistentContextFunction · 0.85

Tested by

no test coverage detected