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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

232];
233
234export default function MainFeedLayout({
235 feedName: feedNameProp,
236 searchQuery,
237 isSearchOn,
238 children,
239 searchChildren,
240 shortcuts,
241 navChildren,
242 isFinder,
243 onNavTabClick,
244}: MainFeedLayoutProps): ReactElement {
245 useScrollRestoration();
246 const { sortingEnabled, loadedSettings } = useContext(SettingsContext);
247 const { user, tokenRefreshed } = useContext(AuthContext);
248 const { alerts } = useContext(AlertContext);
249 const { numCards: feedSpacinessCards } = useContext(FeedContext);
250 const feedWidthStyle = {
251 '--num-cards': feedSpacinessCards.eco,
252 '--feed-gap': '2rem',
253 } as CSSProperties;
254 const router = useRouter();
255 const [tab, setTab] = useState(ExploreTabs.Popular);
256 const feedName = getFeedName(feedNameProp, {
257 hasFiltered: !alerts?.filter,
258 hasUser: !!user,
259 });
260 const { isCustomDefaultFeed, defaultFeedId } = useCustomDefaultFeed();
261 const isLaptop = useViewSize(ViewSize.Laptop);
262 const { isV2 } = useLayoutVariant();
263 const feedVersion = useFeature(feature.feedVersion);
264 const { time, contentCurationFilter } = useSearchContextProvider();
265 const isExtension = checkIsExtension();
266 const isHomePage = router.pathname === webappUrl;
267 const {
268 isUpvoted,
269 isPopular,
270 isAnyExplore,
271 isExploreHub,
272 isExploreLatest,
273 isSortableFeed,
274 isCustomFeed,
275 isSearch: isSearchPage,
276 } = useFeedName({
277 feedName,
278 });
279 useTrackQuestClientEvent({
280 eventType: ClientQuestEventType.VisitExplorePage,
281 enabled: feedName === OtherFeedPage.Explore,
282 });
283 useTrackQuestClientEvent({
284 eventType: ClientQuestEventType.VisitDiscussionsPage,
285 enabled: feedName === OtherFeedPage.Discussed,
286 });
287 const {
288 shouldUseListFeedLayout: shouldUseListFeedLayoutRaw,
289 shouldUseCommentFeedLayout,
290 FeedPageLayoutComponent: FeedPageLayoutComponentRaw,
291 } = useFeedLayout();

Callers

nothing calls this directly

Calls 15

useScrollRestorationFunction · 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
useSearchIdFunction · 0.90
useFeedsFunction · 0.90

Tested by

no test coverage detected