-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
86 lines (73 loc) · 2.81 KB
/
admin.html
File metadata and controls
86 lines (73 loc) · 2.81 KB
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
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/x-icon" href="/admin/favicon.png">
<title>FlashStudy Admin Dashboard</title>
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
background-color: #f4f4f4;
overflow: hidden;
}
#sidebar {
width: 250px;
height: 100vh;
background-color: #333;
color: white;
padding: 20px;
box-sizing: border-box;
box-shadow: rgba(255, 255, 255, 0.1) 0px 1px 1px 0px inset, rgba(50, 50, 93, 0.25) 0px 50px 100px -20px, rgba(0, 0, 0, 0.3) 0px 30px 60px -30px;
}
#timestamp {
position: absolute;
bottom: 0;
}
#stats {
position: absolute;
width: calc(100% - 250px);
left: 250px;
top: 0;
padding: 20px;
}
#stats h2 {
margin-top: 0;
}
</style>
</head>
<body>
<div id="sidebar">
<p id="timestamp"></p>
</div>
<div id="stats">
<h2>Usage Statistics</h2>
<ul>
<li>Total Accounts: <span id="total-accounts">Loading...</span></li>
<li>Total Sets: <span id="total-sets">Loading...</span></li>
<li>Total Notes: <span id="total-notes">Loading...</span></li>
</ul>
</div>
<script>
window.addEventListener('load', async () =>
{
const timestampEle = document.getElementById('timestamp');
let now = new Date();
timestampEle.innerText = `Last updated: \n ${now.toLocaleDateString()} ${now.toLocaleTimeString()}`;
const totalAccountsEle = document.getElementById('total-accounts');
const totalSetsEle = document.getElementById('total-sets');
const totalNotesEle = document.getElementById('total-notes');
let accountsRes = await fetch(`/admin/total/accounts`);
accounts = await accountsRes.json();
let setsRes = await fetch(`/admin/total/sets`);
sets = await setsRes.json();
let notesRes = await fetch(`/admin/total/notes`);
notes = await notesRes.json();
totalAccountsEle.innerText = accounts.count;
totalSetsEle.innerText = sets.count;
totalNotesEle.innerText = notes.count;
})
</script>
</body>
</html>