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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

284];
285
286export default function MainFeedLayout({
287 feedName: feedNameProp,
288 searchQuery,
289 isSearchOn,
290 children,
291 searchChildren,
292 shortcuts,
293 navChildren,
294 isFinder,
295 onNavTabClick,
296 pageHeaderContent,
297}: MainFeedLayoutProps): ReactElement {
298 const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
299 const { user, isTokenValid } = useContext(AuthContext);
300 const { alerts } = useContext(AlertContext);
301 const { numCards: feedSpacinessCards } = useContext(FeedContext);
302 const feedWidthStyle = {
303 '--num-cards': feedSpacinessCards.eco,
304 '--feed-gap': '1.5rem',
305 } as CSSProperties;
306 const router = useRouter();
307 const [tab, setTab] = useState(ExploreTabs.Popular);
308 const feedName = getFeedName(feedNameProp, {
309 hasFiltered: !alerts?.filter,
310 hasUser: !!user,
311 });
312 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
313 const isLaptop = useViewSize(ViewSize.Laptop);
314 // Explore's hub is in the server HTML for phones, shown by CSS: the
315 // server cannot know the screen, so it and the first client render emit
316 // it, and wider screens drop it once they have mounted.
317 const [hasMounted, setHasMounted] = useState(false);
318 const isPhoneWidth = useViewSize(ViewSize.MobileL) && !isLaptop;
319 useEffect(() => {
320 setHasMounted(true);
321 }, []);
322 const isPhone = useIsPhone();
323 const isLaptopLayout = useLaptopLayout();
324 const feedVersion = useFeature(feature.feedVersion);
325 const { time, contentCurationFilter, postTypesFilter } =
326 useSearchContextProvider();
327 const isExtension = checkIsExtension();
328 const isExploreRoot =
329 !isExtension && isRootView(ShellRoot.Explore, router?.pathname ?? '');
330 const isHomePage = router.pathname === webappUrl;
331 const {
332 isUpvoted,
333 isPopular,
334 isAnyExplore,
335 isExploreLatest,
336 isSortableFeed,
337 isCustomFeed,
338 isSearch: isSearchPage,
339 } = useFeedName({
340 feedName,
341 });
342 useTrackQuestClientEvent({
343 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