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

Function add

source/features/list-prs-for-branch.tsx:23–46  ·  view source on GitHub ↗
(parent: HTMLDetailsElement)

Source from the content-addressed store, hash-verified

21};
22
23async function add(parent: HTMLDetailsElement): Promise<void | false> {
24 const prsByBranch = await pullRequestsAssociatedWithBranch.get();
25 const currentBranch = getCurrentGitRef()!;
26 const prInfo = prsByBranch[currentBranch];
27 if (!prInfo) {
28 return;
29 }
30
31 const StateIcon = stateIcon[prInfo.state];
32
33 addAfterBranchSelector(
34 parent,
35 <a
36 data-issue-and-pr-hovercards-enabled
37 href={prInfo.url}
38 className="btn flex-self-center rgh-list-prs-for-branch"
39 data-hovercard-type="pull_request"
40 data-hovercard-url={prInfo.url + '/hovercard'}
41 >
42 <StateIcon className={stateColorMap[prInfo.state]} />
43 <span> #{prInfo.number}</span>
44 </a>,
45 );
46}
47
48async function init(signal: AbortSignal): Promise<false | void> {
49 observe(branchSelectorParent, add, {signal});

Callers

nothing calls this directly

Calls 3

getCurrentGitRefFunction · 0.85
addAfterBranchSelectorFunction · 0.85
getMethod · 0.80

Tested by

no test coverage detected