( latestTag: string, aheadBy: number, )
| 72 | }); |
| 73 | |
| 74 | async function createLink( |
| 75 | latestTag: string, |
| 76 | aheadBy: number, |
| 77 | ): Promise<HTMLElement> { |
| 78 | const commitCount = aheadBy === undeterminableAheadBy |
| 79 | ? 'More than 20 unreleased commits' |
| 80 | : pluralize(aheadBy, '$$ unreleased commit'); |
| 81 | const label = `${commitCount}\nsince ${abbreviateString(latestTag, 30)}`; |
| 82 | |
| 83 | return ( |
| 84 | <a |
| 85 | className="btn px-2 tmp-px-2 tooltipped tooltipped-se" |
| 86 | href={buildRepoUrl('compare', `${latestTag}...${await getDefaultBranch()}`)} |
| 87 | aria-label={label} |
| 88 | > |
| 89 | <TagIcon /> |
| 90 | {' '} |
| 91 | {aheadBy === undeterminableAheadBy || <sup className="ml-n2 tmp-ml-n2">+{aheadBy}</sup>} |
| 92 | </a> |
| 93 | ); |
| 94 | } |
| 95 | |
| 96 | async function createLinkGroup(latestTag: string, aheadBy: number): Promise<HTMLElement> { |
| 97 | const link = await createLink(latestTag, aheadBy); |
no test coverage detected