({
feedRelated = true,
}: UseFeedLayoutProps = {})
| 122 | }; |
| 123 | |
| 124 | export const useFeedLayout = ({ |
| 125 | feedRelated = true, |
| 126 | }: UseFeedLayoutProps = {}): UseFeedLayoutReturn => { |
| 127 | const isLaptopSize = useViewSize(ViewSize.Laptop); |
| 128 | const isLaptop = isLaptopSize; |
| 129 | const { feedName } = useActiveFeedNameContext(); |
| 130 | const { insaneMode } = useContext(SettingsContext); |
| 131 | const { isSearchPageLaptop } = useSearchResultsLayout(); |
| 132 | |
| 133 | const isPostFeedPage = PostFeedPages.has(feedName as OtherFeedPage); |
| 134 | |
| 135 | const isListMode = |
| 136 | isSearchPageLaptop || |
| 137 | insaneMode || |
| 138 | ListModeOnlyFeedPages.has(feedName as OtherFeedPage); |
| 139 | |
| 140 | const shouldUseListFeedLayoutOnProfilePages = UserProfileFeedPages.has( |
| 141 | feedName as UserProfileFeedType, |
| 142 | ); |
| 143 | |
| 144 | const isFeedIncludedInListLayout = FeedLayoutMobileFeedPages.has( |
| 145 | feedName as OtherFeedPage, |
| 146 | ); |
| 147 | |
| 148 | const shouldUseListFeedLayoutOnMobileTablet = |
| 149 | !isLaptop && isFeedIncludedInListLayout; |
| 150 | |
| 151 | const shouldUseListMode = |
| 152 | (isListMode && isLaptop && isFeedIncludedInListLayout) || isPostFeedPage; |
| 153 | |
| 154 | const shouldUseListFeedLayout = feedRelated |
| 155 | ? shouldUseListFeedLayoutOnMobileTablet || |
| 156 | shouldUseListFeedLayoutOnProfilePages || |
| 157 | shouldUseListMode |
| 158 | : isListMode || !isLaptop; |
| 159 | |
| 160 | const shouldUseCommentFeedLayout = feedName === OtherFeedPage.Discussed; |
| 161 | |
| 162 | const FeedPageLayoutComponent = getFeedPageLayoutComponent({ |
| 163 | shouldUseListMode, |
| 164 | shouldUseListFeedLayoutOnMobileTablet, |
| 165 | shouldUseCommentFeedLayout, |
| 166 | isSearchPageLaptop, |
| 167 | }); |
| 168 | |
| 169 | return { |
| 170 | shouldUseListFeedLayout, |
| 171 | shouldUseCommentFeedLayout, |
| 172 | FeedPageLayoutComponent, |
| 173 | isListMode, |
| 174 | shouldUseListMode, |
| 175 | screenCenteredOnMobileLayout: |
| 176 | shouldUseListFeedLayoutOnMobileTablet && |
| 177 | !UserProfileFeedPages.has(feedName as UserProfileFeedType), |
| 178 | }; |
| 179 | }; |
no test coverage detected