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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

224];
225
226export default function MainFeedLayout({
227 feedName: feedNameProp,
228 searchQuery,
229 isSearchOn,
230 children,
231 searchChildren,
232 shortcuts,
233 navChildren,
234 isFinder,
235 onNavTabClick,
236}: MainFeedLayoutProps): ReactElement {
237 useScrollRestoration();
238 const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
239 const { user, tokenRefreshed } = useContext(AuthContext);
240 const { alerts } = useContext(AlertContext);
241 const { numCards: feedSpacinessCards } = useContext(FeedContext);
242 const router = useRouter();
243 const [tab, setTab] = useState(ExploreTabs.Popular);
244 const { getFeatureValue } = useFeaturesReadyContext();
245 const feedName = getFeedName(feedNameProp, {
246 hasFiltered: !alerts?.filter,
247 hasUser: !!user,
248 });
249 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
250 const isLaptop = useViewSize(ViewSize.Laptop);
251 const { isV2 } = useLayoutVariant();
252 const feedVersion = useFeature(feature.feedVersion);
253 const { time, contentCurationFilter } = useSearchContextProvider();
254 const isExtension = checkIsExtension();
255 const isHomePage = router.pathname === webappUrl;
256 const {
257 isUpvoted,
258 isPopular,
259 isAnyExplore,
260 isExploreLatest,
261 isSortableFeed,
262 isCustomFeed,
263 isSearch: isSearchPage,
264 } = useFeedName({
265 feedName,
266 });
267 useTrackQuestClientEvent({
268 eventType: ClientQuestEventType.VisitExplorePage,
269 enabled: feedName === OtherFeedPage.Explore,
270 });
271 useTrackQuestClientEvent({
272 eventType: ClientQuestEventType.VisitDiscussionsPage,
273 enabled: feedName === OtherFeedPage.Discussed,
274 });
275 const {
276 shouldUseListFeedLayout: shouldUseListFeedLayoutRaw,
277 shouldUseCommentFeedLayout,
278 FeedPageLayoutComponent: FeedPageLayoutComponentRaw,
279 } = useFeedLayout();
280
281 // SSR renders /explore/[tag] with FeedPageLayoutMobile. On client hydration with
282 // a laptop viewport the layout swaps to FeedPage, which causes a hydration
283 // Done just for explore tag for now to avoid impact other pages

Callers

nothing calls this directly

Calls 15

useScrollRestorationFunction · 0.90
useFeaturesReadyContextFunction · 0.90
getFeedNameFunction · 0.90
useViewSizeFunction · 0.90
useLayoutVariantFunction · 0.90
useFeatureFunction · 0.90
checkIsExtensionFunction · 0.90
useFeedNameFunction · 0.90
useTrackQuestClientEventFunction · 0.90
useFeedLayoutFunction · 0.90
useConditionalFeatureFunction · 0.90
useFeedsFunction · 0.90

Tested by

no test coverage detected