Add total and daily calls to frontpage!
This commit is contained in:
parent
e3ece6a02d
commit
434390cb9b
|
@ -3,7 +3,6 @@
|
|||
let ass = 0;
|
||||
|
||||
function switchit() {
|
||||
console.log("ass");
|
||||
document.querySelector(".text-wrapper").style = "";
|
||||
document.querySelector(".text-wrapper").firstElementChild.remove();
|
||||
var c = document.querySelector(".text-wrapper").firstElementChild.cloneNode(true);
|
||||
|
@ -33,3 +32,15 @@ $(document).ready(function() {
|
|||
$("#signin").on("click", function () {
|
||||
$(".signinmenu").slideDown();
|
||||
});
|
||||
|
||||
// Pull analytics from /api/analytics
|
||||
setInterval(() => {
|
||||
fetch('/api/analytics')
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
estCallsMadeStat = data.total.find(stat => stat.tag === "estCallsMade")?.count;
|
||||
currentDailyCallsMadeStat = data.daily.find(stat => stat.tag === "dailyCallsMade" && stat.current === true)?.count;
|
||||
chgtext(`Total calls made: ${estCallsMadeStat} | Today's calls made: ${currentDailyCallsMadeStat}`);
|
||||
})
|
||||
.catch(error => console.error('Error fetching analytics:', error));
|
||||
}, 2000)
|
|
@ -1,5 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta charset="UTF-8">
|
||||
<title>AstroCom</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
@ -18,13 +21,14 @@
|
|||
{"name":"AstroCom","description":"Simplifying communication.","@type":"WebSite","url":"https://astrocom.tel/","headline":"AstroCom","@context":"http://schema.org"}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="center">
|
||||
<div class="fadein">
|
||||
<h1 class="title">AstroCom</h1>
|
||||
<div class="text-container">
|
||||
<div class="text-wrapper" id="textWrapper">
|
||||
<div class="text">...</div>
|
||||
<div class="text"></div>
|
||||
<div class="text"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -47,4 +51,5 @@
|
|||
<script src="assets/js/snow.js"></script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||
<script src="assets/js/landing.js"></script>
|
||||
|
||||
</html>
|
Loading…
Reference in a new issue