blob: b6b983f4e88150d8517f21f1aee10f0a18cbcca4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
import React from 'dom-chef';
import select from 'select-dom';
import * as pageDetect from 'github-url-detection';
import {LinkExternalIcon} from '@primer/octicons-react';
import features from '.';
import onConversationHeaderUpdate from '../github-events/on-conversation-header-update';
const deploymentSelector = '.js-timeline-item [data-url$="deployed"] .TimelineItem-body .btn[target="_blank"]';
function init(): void {
if (select.exists('.rgh-last-deployment')) {
return;
}
const {href} = select.last<HTMLAnchorElement>(deploymentSelector)!;
select('.gh-header-actions')!.prepend(
<a
className="rgh-last-deployment btn btn-sm d-none d-md-block mr-1"
href={href}
target="_blank"
rel="noreferrer"
>
<LinkExternalIcon className="mr-1"/> View deployment
</a>,
);
}
void features.add(__filebasename, {
include: [
pageDetect.isPRConversation,
],
exclude: [
() => !select.exists(deploymentSelector),
],
additionalListeners: [
onConversationHeaderUpdate,
],
init,
});
|