(item: FeedItem, index: number)
| 114 | Pick<UseBookmarkPost, 'toggleBookmark'>; |
| 115 | |
| 116 | export function getFeedItemKey(item: FeedItem, index: number): string { |
| 117 | switch (item.type) { |
| 118 | case 'post': |
| 119 | return item.post.id; |
| 120 | case 'highlight': |
| 121 | return getHighlightIdsKey(item.highlights) || `highlight-${index}`; |
| 122 | case 'ad': |
| 123 | return `ad-${index}`; |
| 124 | case 'widget': |
| 125 | return `widget-${item.widget.id}`; |
| 126 | default: |
| 127 | return `placeholder-${index}`; |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | const getPostTypeForCard = (post?: Post): PostType => { |
| 132 | if (!post) { |
no test coverage detected