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