-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
134 lines (113 loc) · 3.33 KB
/
index.html
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html>
<head>
<title>Bitcoin Bay Bartender</title>
<script src="https://cdn.rawgit.com/davidshimjs/qrcodejs/gh-pages/qrcode.min.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Ubuntu">
</head>
<script>
console.log("warming up")
setTimeout(() => {
const ws = new WebSocket("ws://localhost:3030/bartender");
ws.addEventListener("open", () => {
ws.send("heyhowareya");
});
ws.addEventListener("message", (event) => {
const message = event.data;
if (message === "hey-bartender-pour-me-a-beer") {
console.log("Pour beer!", message)
pouringBeer();
} else if (message.startsWith("ln")) {
console.log("New bar tab!", message);
showQRCode(message);
}
});
ws.addEventListener("close", () => {
console.log("Connection closed");
});
}, 5000);
function pouringBeer() {
console.log("Pouring beer.");
pourBeer.style.display = "block";
barTab.style.display = "none";
}
function showQRCode(data) {
pourBeer.style.display = "none";
barTab.style.display = "block";
generateQRCode(data);
}
function generateQRCode(data) {
let code = document.getElementById("payReq");
code.innerHTML = "";
let qr = new QRCode(document.getElementById("payReq"), {
text: data,
width: 500,
height: 500,
});
}
</script>
<style>
body {
background-color: #0B1439;
color: #FFF;
font-size: 3rem;
}
.container {
display: flex;
flex-direction: column;
width: 100%;
justify-content: space-around;
align-items: center;
height: 100vh;
font-family: "Ubuntu";
}
.payReq {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.pourBeer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.bartender {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.cashapp {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
width: 800px;
}
</style>
<body>
<div class="container">
<div class="bartender">
<h1 class="margin-bottom: 15px;">Bitcoin Bay Bartender</h1>
<div class="cashapp">
<h3 style="margin: 0;">Use CashApp Bitcoin to pay!</h3>
<img src="./cash-app.png" width="75" height="75" />
</div>
<div class="logos">
<img src="./logo.png" width="500" height="500" style="transform: translateX(-50px);" />
<img src="./bitcoin-bay-website.png" width="450" height="450" class="padding-left: 15px;"/>
</div>
</div>
<div id="pourBeer" class="pourBeer" style="display: none;">
<h1 style="text-align: center;">Bar tab paid!</h1>
<img src="./success.png" width="500" height="500" style="transform: translateX(25px);"/>
</div>
<div id="barTab" class="payReq" style="display: none;">
<h1 style="text-align: center;">Pay Bar Tab</h1>
<a id="payReq"></a>
</div>
</div>
</body>
</html>