MCPcopy
hub / github.com/refined-github/refined-github / addStars

Function addStars

source/features/repo-header-info.tsx:66–92  ·  view source on GitHub ↗
(repoLink: HTMLElement, stargazerCount: number, viewerHasStarred: boolean)

Source from the content-addressed store, hash-verified

64}
65
66function addStars(repoLink: HTMLElement, stargazerCount: number, viewerHasStarred: boolean): void {
67 if (stargazerCount <= 1) {
68 return;
69 }
70
71 let tooltip = `Repository starred by ${stargazerCount.toLocaleString('us')} people`;
72 if (viewerHasStarred) {
73 tooltip += ', including you';
74 }
75
76 prepareForAddition(repoLink);
77
78 repoLink.after(
79 <a
80 href={buildRepoUrl('stargazers')}
81 title={tooltip}
82 // Hide in small viewports
83 className="d-none d-sm-flex flex-items-center flex-justify-center gap-1 p-1 tmp-p-1 color-fg-muted Button Button--invisible"
84 >
85 {viewerHasStarred
86 // Use `color` because `fill` is overridden with `currentColor`
87 ? <StarFillIcon width={12} height={12} color="var(--button-star-iconColor)" />
88 : <StarIcon width={12} height={12} />}
89 <span className="f5">{abbreviateNumber(stargazerCount)}</span>
90 </a>,
91 );
92}
93
94function markForked(repoLink: HTMLElement, forked?: {url: string}): void {
95 if (!forked) {

Callers 1

addFunction · 0.85

Calls 3

prepareForAdditionFunction · 0.85
buildRepoUrlFunction · 0.85
abbreviateNumberFunction · 0.85

Tested by

no test coverage detected