Add total and daily calls to frontpage!

This commit is contained in:
Christopher Cookman 2024-12-16 20:31:31 -07:00
parent e3ece6a02d
commit 434390cb9b
2 changed files with 73 additions and 57 deletions

View file

@ -3,7 +3,6 @@
let ass = 0; let ass = 0;
function switchit() { function switchit() {
console.log("ass");
document.querySelector(".text-wrapper").style = ""; document.querySelector(".text-wrapper").style = "";
document.querySelector(".text-wrapper").firstElementChild.remove(); document.querySelector(".text-wrapper").firstElementChild.remove();
var c = document.querySelector(".text-wrapper").firstElementChild.cloneNode(true); var c = document.querySelector(".text-wrapper").firstElementChild.cloneNode(true);
@ -25,11 +24,23 @@ function chgtext(tex) {
}; };
$(document).ready(function() { $(document).ready(function () {
$(".fadein").fadeIn(1250); $(".fadein").fadeIn(1250);
}); });
$("#signin").on("click", function() { $("#signin").on("click", function () {
$(".signinmenu").slideDown(); $(".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)

View file

@ -1,10 +1,13 @@
<!DOCTYPE html> <!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"> <meta charset="UTF-8">
<title>AstroCom</title> <title>AstroCom</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="assets/css/root-style.css" rel="stylesheet" type="text/css" media="all"> <link href="assets/css/root-style.css" rel="stylesheet" type="text/css" media="all">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.7.1/css/all.min.css" />
<meta name="msapplication-TileColor" content="#000000"> <meta name="msapplication-TileColor" content="#000000">
<meta name="msapplication-square150x150logo" content="https://astrocom.tel/assets/images/logo.png"> <meta name="msapplication-square150x150logo" content="https://astrocom.tel/assets/images/logo.png">
<link rel="apple-touch-icon" href="https://astrocom.tel/assets/images/logo.png"> <link rel="apple-touch-icon" href="https://astrocom.tel/assets/images/logo.png">
@ -18,13 +21,14 @@
{"name":"AstroCom","description":"Simplifying communication.","@type":"WebSite","url":"https://astrocom.tel/","headline":"AstroCom","@context":"http://schema.org"} {"name":"AstroCom","description":"Simplifying communication.","@type":"WebSite","url":"https://astrocom.tel/","headline":"AstroCom","@context":"http://schema.org"}
</script> </script>
</head> </head>
<body> <body>
<div class="center"> <div class="center">
<div class="fadein"> <div class="fadein">
<h1 class="title">AstroCom</h1> <h1 class="title">AstroCom</h1>
<div class="text-container"> <div class="text-container">
<div class="text-wrapper" id="textWrapper"> <div class="text-wrapper" id="textWrapper">
<div class="text">...</div> <div class="text"></div>
<div class="text"></div> <div class="text"></div>
</div> </div>
</div> </div>
@ -47,4 +51,5 @@
<script src="assets/js/snow.js"></script> <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="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="assets/js/landing.js"></script> <script src="assets/js/landing.js"></script>
</html> </html>