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