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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

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

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