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

Function MainFeedLayout

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

Source from the content-addressed store, hash-verified

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

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