This repository has been archived by the owner on May 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.html
60 lines (50 loc) · 1.55 KB
/
dashboard.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Well Ping Dashboard - Fall 2020</title>
<style>
.each-value {
font-weight: bold;
}
</style>
</head>
<body>
<div style="margin: 20px">
<h3 id="to-bonus"></h3>
<p>
(You have completed
<span id="completed-pings-this-week-name"></span> this week.)
</p>
</div>
<script>
const urlParams = new URLSearchParams(window.location.search);
const completedPingsThisWeek = urlParams.get("completed_pings_this_week");
const username = urlParams.get("username");
function getPingName(count) {
if (count > 1) {
return " pings";
} else {
return " ping";
}
}
let completedPingsThisWeekName =
completedPingsThisWeek.toString() + getPingName(completedPingsThisWeek);
document.getElementById(
"completed-pings-this-week-name"
).innerHTML = completedPingsThisWeekName;
const pingsAwayFromWeeklyBonus = 24 - completedPingsThisWeek;
if (pingsAwayFromWeeklyBonus <= 0) {
document.getElementById("to-bonus").innerHTML =
"You have reached the weekly bonus!";
} else {
document.getElementById("to-bonus").innerHTML =
"You are " +
pingsAwayFromWeeklyBonus.toString() +
getPingName(pingsAwayFromWeeklyBonus) +
" away from the weekly bonus!";
}
</script>
</body>
</html>