({
children,
topContent,
header,
footer,
className,
inlineHeader = false,
showSearch,
shortcuts,
actionButtons,
isHorizontal,
feedContainerRef,
showBriefCard,
disableListFrame = false,
}: FeedContainerProps)
| 120 | }; |
| 121 | |
| 122 | export const FeedContainer = ({ |
| 123 | children, |
| 124 | topContent, |
| 125 | header, |
| 126 | footer, |
| 127 | className, |
| 128 | inlineHeader = false, |
| 129 | showSearch, |
| 130 | shortcuts, |
| 131 | actionButtons, |
| 132 | isHorizontal, |
| 133 | feedContainerRef, |
| 134 | showBriefCard, |
| 135 | disableListFrame = false, |
| 136 | }: FeedContainerProps): ReactElement => { |
| 137 | const currentSettings = useContext(FeedContext); |
| 138 | const { subject } = useToastNotification(); |
| 139 | const { loadedSettings } = useContext(SettingsContext); |
| 140 | const { shouldUseListFeedLayout, isListMode } = useFeedLayout(); |
| 141 | const isLaptop = useViewSize(ViewSize.Laptop); |
| 142 | const { isV2 } = useLayoutVariant(); |
| 143 | const isV2Laptop = isV2; |
| 144 | const { feedName } = useActiveFeedNameContext(); |
| 145 | const activeFeedName = feedName ?? SharedFeedPage.MyFeed; |
| 146 | const { isAnyExplore, isExplorePopular, isExploreLatest } = useFeedName({ |
| 147 | feedName: activeFeedName, |
| 148 | }); |
| 149 | const router = useRouter(); |
| 150 | const numCards = currentSettings.numCards.eco; |
| 151 | const isList = |
| 152 | (isHorizontal || isListMode) && !shouldUseListFeedLayout |
| 153 | ? false |
| 154 | : (isListMode && numCards > 1) || shouldUseListFeedLayout; |
| 155 | const feedGapClass = gapClass({ |
| 156 | isList, |
| 157 | isFeedLayoutList: shouldUseListFeedLayout, |
| 158 | }) as FeedGapClass; |
| 159 | const gapSizePx = feedGapPx[feedGapClass]; |
| 160 | const style = { |
| 161 | '--num-cards': isHorizontal && isListMode && numCards >= 2 ? 2 : numCards, |
| 162 | '--feed-gap': `${gapSizePx / 16}rem`, |
| 163 | } as CSSProperties; |
| 164 | const isFinder = router.pathname === '/search/posts'; |
| 165 | const isSearch = showSearch && !isFinder; |
| 166 | |
| 167 | const { feeds } = useFeeds(); |
| 168 | |
| 169 | const feedHeading = useMemo(() => { |
| 170 | if (activeFeedName === SharedFeedPage.Custom) { |
| 171 | const customFeed = feeds?.edges.find( |
| 172 | ({ node: feed }) => |
| 173 | feed.id === router.query.slugOrId || |
| 174 | feed.slug === router.query.slugOrId, |
| 175 | )?.node; |
| 176 | |
| 177 | if (customFeed?.flags?.name) { |
| 178 | return customFeed.flags.name; |
| 179 | } |
nothing calls this directly
no test coverage detected