({
feedName: feedNameProp,
searchQuery,
isSearchOn,
children,
searchChildren,
shortcuts,
navChildren,
isFinder,
onNavTabClick,
pageHeaderContent,
}: MainFeedLayoutProps)
| 379 | ]; |
| 380 | |
| 381 | export 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, |
nothing calls this directly
no test coverage detected