-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevent.handlers.js
48 lines (30 loc) · 1.75 KB
/
event.handlers.js
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
41
42
43
44
45
46
47
import { formatSats } from './utils.js';
export const longPressLink = async (d) => {
const selectedLink = d.srcElement.__data__;
//console.log('longPressLink: ', selectedLink);
let msg = `<b>Channel ID:</b> ${selectedLink.channel_id} <br/> <br/>`;
msg += `<b>Capacity:</b> ${selectedLink.capacity} sats (${formatSats(selectedLink.capacity)}) <br/> <br/>`;
msg += `<b>Channel Point: </b> ${selectedLink.channel_point} <br/> <br/>`;
msg += `<b>Source Node:</b> ${selectedLink.source.public_key} <br/> <br/>`;
msg += `<b>Target Node:</b> ${selectedLink.target.public_key} <br/> <br/>`;
const myModal = new bootstrap.Modal(document.getElementById('nodeTipModel'))
myModal.show();
document.getElementById('nodeTipBody').innerHTML = msg;
}
export const longPressNode = async (d) => {
const selectedNode = d.srcElement.__data__;
const pub_key = selectedNode.pub_key;
//console.log('longPressNode: ', selectedNode);
let msg = `<b>Alias:</b> ${selectedNode.alias} <br/> <br/>`;
msg += `<b>Capacity:</b> ${selectedNode.capacity} sats (${formatSats(selectedNode.capacity)}) <br/> <br/>`;
msg += `<b>Public Key:</b> ${selectedNode.public_key} <br/> <br/>`;
msg += `<b>Channel count:</b> ${selectedNode.channel_count} <br/> <br/>`;
msg += `<b>Socket:</b> ${ selectedNode.sockets && selectedNode.sockets.length > 0 ? selectedNode.sockets.join(', '): 'None'} <br/> <br/>`;
const myModal = new bootstrap.Modal(document.getElementById('nodeTipModel'))
myModal.show();
document.getElementById('nodeTipBody').innerHTML = msg;
}
document.getElementById('helpBtn').addEventListener('click', () => {
const myModal = new bootstrap.Modal(document.getElementById('helpModel'));
myModal.show();
});