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