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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

379];
380
381export default function MainFeedLayout({
382 feedName: feedNameProp,
383 searchQuery,
384 isSearchOn,
385 children,
386 searchChildren,
387 shortcuts,
388 navChildren,
389 isFinder,
390 onNavTabClick,
391 pageHeaderContent,
392}: MainFeedLayoutProps): ReactElement {
393 const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
394 const { user, isTokenValid } = useContext(AuthContext);
395 const { alerts } = useContext(AlertContext);
396 const { numCards: feedSpacinessCards } = useContext(FeedContext);
397 const feedWidthStyle = {
398 '--num-cards': feedSpacinessCards.eco,
399 '--feed-gap': '1.5rem',
400 } as CSSProperties;
401 const router = useRouter();
402 const [tab, setTab] = useState(ExploreTabs.Popular);
403 const feedName = getFeedName(feedNameProp, {
404 hasFiltered: !alerts?.filter,
405 hasUser: !!user,
406 });
407 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
408 const isLaptop = useViewSize(ViewSize.Laptop);
409 // Explore's hub is in the server HTML for phones, shown by CSS: the
410 // server cannot know the screen, so it and the first client render emit
411 // it, and wider screens drop it once they have mounted.
412 const [hasMounted, setHasMounted] = useState(false);
413 const isPhoneWidth = useViewSize(ViewSize.MobileL) && !isLaptop;
414 useEffect(() => {
415 setHasMounted(true);
416 }, []);
417 const isPhone = useIsPhone();
418 const isLaptopLayout = useLaptopLayout();
419 const feedVersion = useFeature(feature.feedVersion);
420 const { time, contentCurationFilter, postTypesFilter } =
421 useSearchContextProvider();
422 const isExtension = checkIsExtension();
423 const isExploreRoot =
424 !isExtension && isRootView(ShellRoot.Explore, router?.pathname ?? '');
425 const isHomePage = router.pathname === webappUrl;
426 const {
427 isUpvoted,
428 isPopular,
429 isAnyExplore,
430 isExploreLatest,
431 isSortableFeed,
432 isCustomFeed,
433 isSearch: isSearchPage,
434 } = useFeedName({
435 feedName,
436 });
437 useTrackQuestClientEvent({
438 eventType: ClientQuestEventType.VisitExplorePage,

Callers

nothing calls this directly

Calls 15

getFeedNameFunction · 0.90
useViewSizeFunction · 0.90
useIsPhoneFunction · 0.90
useLaptopLayoutFunction · 0.90
useFeatureFunction · 0.90
checkIsExtensionFunction · 0.90
isRootViewFunction · 0.90
useFeedNameFunction · 0.90
useTrackQuestClientEventFunction · 0.90
useFeedLayoutFunction · 0.90
useConditionalFeatureFunction · 0.90
getSearchPageProviderFunction · 0.90

Tested by

no test coverage detected