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

Function FeedContainer

packages/shared/src/components/feeds/FeedContainer.tsx:127–425  ·  view source on GitHub ↗
({
  children,
  topContent,
  header,
  footer,
  className,
  inlineHeader = false,
  showSearch,
  shortcuts,
  actionButtons,
  isHorizontal,
  feedContainerRef,
  hasFirstSlotCard,
  disableListFrame = false,
}: FeedContainerProps)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 15

useToastNotificationFunction · 0.90
useFeedLayoutFunction · 0.90
useViewSizeFunction · 0.90
useLayoutVariantFunction · 0.90
useActiveFeedNameContextFunction · 0.90
useFeedNameFunction · 0.90
useFeedsFunction · 0.90
useBootFunction · 0.90
useJobsFeatureFunction · 0.90
useUploadCvFunction · 0.90
useHasIntroQuestsFunction · 0.90
gapClassFunction · 0.85

Tested by

no test coverage detected