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

Function useFeedLayout

packages/shared/src/hooks/useFeedLayout.ts:110–158  ·  view source on GitHub ↗
({
  feedRelated = true,
}: UseFeedLayoutProps = {})

Source from the content-addressed store, hash-verified

108};
109
110export const useFeedLayout = ({
111 feedRelated = true,
112}: UseFeedLayoutProps = {}): UseFeedLayoutReturn => {
113 const isLaptopSize = useViewSize(ViewSize.Laptop);
114 const isLaptop = isLaptopSize;
115 const { feedName } = useActiveFeedNameContext();
116 const { insaneMode } = useContext(SettingsContext);
117 const { isSearchPageLaptop } = useSearchResultsLayout();
118
119 const isPostFeedPage = PostFeedPages.has(feedName as OtherFeedPage);
120
121 const isListMode =
122 isSearchPageLaptop ||
123 insaneMode ||
124 ListModeOnlyFeedPages.has(feedName as OtherFeedPage);
125
126 const shouldUseListFeedLayoutOnProfilePages = UserProfileFeedPages.has(
127 feedName as UserProfileFeedType,
128 );
129
130 const isFeedIncludedInListLayout = FeedLayoutMobileFeedPages.has(
131 feedName as OtherFeedPage,
132 );
133
134 const shouldUseListFeedLayoutOnMobileTablet =
135 !isLaptop && isFeedIncludedInListLayout;
136
137 const shouldUseListMode =
138 (isListMode && isLaptop && isFeedIncludedInListLayout) || isPostFeedPage;
139
140 const shouldUseListFeedLayout = feedRelated
141 ? shouldUseListFeedLayoutOnMobileTablet ||
142 shouldUseListFeedLayoutOnProfilePages ||
143 shouldUseListMode
144 : isListMode || !isLaptop;
145
146 const FeedPageLayoutComponent = getFeedPageLayoutComponent({
147 shouldUseListMode,
148 shouldUseListFeedLayoutOnMobileTablet,
149 isSearchPageLaptop,
150 });
151
152 return {
153 shouldUseListFeedLayout,
154 FeedPageLayoutComponent,
155 isListMode,
156 shouldUseListMode,
157 };
158};

Callers 15

FeedGridFunction · 0.90
FeedFunction · 0.90
FeedItemComponentFunction · 0.90
MainFeedLayoutFunction · 0.90
SearchResultsLayoutFunction · 0.90
MarketingCtaVideoFunction · 0.90
PostTagsFunction · 0.90
MyFeedHeadingFunction · 0.90
FeedContainerFunction · 0.90
HorizontalFeedFunction · 0.90
useFeedHeroAdFunction · 0.90
EntityFeedGridFunction · 0.90

Calls 4

useViewSizeFunction · 0.90
useActiveFeedNameContextFunction · 0.90
useSearchResultsLayoutFunction · 0.90

Tested by

no test coverage detected