(reactionsContainer: Element)
| 63 | } |
| 64 | |
| 65 | function showAvatarsOn(reactionsContainer: Element): void { |
| 66 | const reactions = $$optional([ |
| 67 | 'button[aria-pressed]', // Discussions, releases, PRs, old issues |
| 68 | 'button[aria-checked]', // React issues |
| 69 | ], reactionsContainer) |
| 70 | .map(button => getParticipants(button)); // Get all participants for each reaction |
| 71 | if (reactions.length === 0) { |
| 72 | return; |
| 73 | } |
| 74 | |
| 75 | const avatarLimit = arbitraryAvatarLimit - (reactions.length * approximateHeaderLength); |
| 76 | const flatParticipants = flatZip(reactions, avatarLimit); |
| 77 | |
| 78 | for (const {button, username, imageUrl} of flatParticipants) { |
| 79 | button.append( |
| 80 | <span className="avatar-user avatar rgh-reactions-avatar p-0 tmp-p-0 flex-self-center"> |
| 81 | <img |
| 82 | src={imageUrl} |
| 83 | className="d-block" |
| 84 | width={avatarSize} |
| 85 | height={avatarSize} |
| 86 | alt={`@${username}`} |
| 87 | loading="lazy" |
| 88 | /> |
| 89 | </span>, |
| 90 | ); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | const viewportObserver = new IntersectionObserver(changes => { |
| 95 | for (const change of changes) { |
no test coverage detected