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

Function MainFeedLayout

packages/shared/src/components/MainFeedLayout.tsx:236–904  ·  view source on GitHub ↗
({
  feedName: feedNameProp,
  searchQuery,
  isSearchOn,
  children,
  searchChildren,
  shortcuts,
  navChildren,
  isFinder,
  onNavTabClick,
}: MainFeedLayoutProps)

Source from the content-addressed store, hash-verified

234];
235
236export default function MainFeedLayout({
237 feedName: feedNameProp,
238 searchQuery,
239 isSearchOn,
240 children,
241 searchChildren,
242 shortcuts,
243 navChildren,
244 isFinder,
245 onNavTabClick,
246}: MainFeedLayoutProps): ReactElement {
247 useScrollRestoration();
248 const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
249 const { user, tokenRefreshed } = useContext(AuthContext);
250 const { alerts } = useContext(AlertContext);
251 const { numCards: feedSpacinessCards } = useContext(FeedContext);
252 const feedWidthStyle = {
253 '--num-cards': feedSpacinessCards.eco,
254 '--feed-gap': '2rem',
255 } as CSSProperties;
256 const router = useRouter();
257 const [tab, setTab] = useState(ExploreTabs.Popular);
258 const feedName = getFeedName(feedNameProp, {
259 hasFiltered: !alerts?.filter,
260 hasUser: !!user,
261 });
262 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
263 const isLaptop = useViewSize(ViewSize.Laptop);
264 const { isV2 } = useLayoutVariant();
265 const feedVersion = useFeature(feature.feedVersion);
266 const { time, contentCurationFilter } = useSearchContextProvider();
267 const isExtension = checkIsExtension();
268 const isHomePage = router.pathname === webappUrl;
269 const {
270 isUpvoted,
271 isPopular,
272 isAnyExplore,
273 isExploreHub,
274 isExploreLatest,
275 isSortableFeed,
276 isCustomFeed,
277 isSearch: isSearchPage,
278 } = useFeedName({
279 feedName,
280 });
281 useTrackQuestClientEvent({
282 eventType: ClientQuestEventType.VisitExplorePage,
283 enabled: feedName === OtherFeedPage.Explore,
284 });
285 useTrackQuestClientEvent({
286 eventType: ClientQuestEventType.VisitDiscussionsPage,
287 enabled: feedName === OtherFeedPage.Discussed,
288 });
289 const {
290 shouldUseListFeedLayout: shouldUseListFeedLayoutRaw,
291 shouldUseCommentFeedLayout,
292 FeedPageLayoutComponent: FeedPageLayoutComponentRaw,
293 } = useFeedLayout();

Callers

nothing calls this directly

Calls 15

useScrollRestorationFunction · 0.90
getFeedNameFunction · 0.90
useViewSizeFunction · 0.90
useLayoutVariantFunction · 0.90
useFeatureFunction · 0.90
checkIsExtensionFunction · 0.90
useFeedNameFunction · 0.90
useTrackQuestClientEventFunction · 0.90
useFeedLayoutFunction · 0.90
useConditionalFeatureFunction · 0.90
useSearchIdFunction · 0.90
useFeedsFunction · 0.90

Tested by

no test coverage detected