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

Function PickRow

packages/shared/src/features/daily/CoverGrid.tsx:161–317  ·  view source on GitHub ↗
({
  post,
  position,
  onExpand,
  onBookmark,
  onVoteMutate,
}: {
  post: Post;
  position: number;
  onExpand: () => void;
  onBookmark: () => void;
  onVoteMutate: UseVotePostProps['onMutate'];
})

Source from the content-addressed store, hash-verified

159};
160
161const PickRow = ({
162 post,
163 position,
164 onExpand,
165 onBookmark,
166 onVoteMutate,
167}: {
168 post: Post;
169 position: number;
170 onExpand: () => void;
171 onBookmark: () => void;
172 onVoteMutate: UseVotePostProps['onMutate'];
173}): ReactElement => {
174 const { source } = post;
175 const { title } = useSmartTitle(post);
176 const summary = post.summary || post.sharedPost?.summary;
177 const [isExpanded, setIsExpanded] = useState(false);
178 const panelId = `daily-pick-${post.id}`;
179 const impressionRef = useLogImpression(
180 {
181 type: FeedItemType.Post,
182 post,
183 page: 0,
184 index: position,
185 dataUpdatedAt: 0,
186 },
187 position,
188 1,
189 0,
190 position,
191 DAILY_FEED_NAME,
192 undefined,
193 undefined,
194 Origin.DailyPage,
195 );
196
197 const onToggle = () => {
198 const willOpen = !isExpanded;
199 setIsExpanded(willOpen);
200 if (willOpen) {
201 onExpand();
202 }
203 };
204
205 return (
206 <li ref={impressionRef}>
207 <button
208 type="button"
209 onClick={onToggle}
210 aria-expanded={isExpanded}
211 aria-controls={panelId}
212 className={classNames(
213 'group flex w-full items-center gap-4 px-4 py-4 text-left transition-colors tablet:px-5',
214 !isExpanded && 'hover:bg-surface-float',
215 )}
216 >
217 <Typography
218 tag={TypographyTag.H3}

Callers

nothing calls this directly

Calls 3

useSmartTitleFunction · 0.90
useLogImpressionFunction · 0.85
dailyFeedExtraFunction · 0.70

Tested by

no test coverage detected