diff --git a/public/assets/js/landing.js b/public/assets/js/landing.js index ef0bec0..a6481fc 100644 --- a/public/assets/js/landing.js +++ b/public/assets/js/landing.js @@ -3,33 +3,44 @@ 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); - c.innerHTML = ""; - document.querySelector(".text-wrapper").appendChild(c); + document.querySelector(".text-wrapper").style = ""; + document.querySelector(".text-wrapper").firstElementChild.remove(); + var c = document.querySelector(".text-wrapper").firstElementChild.cloneNode(true); + c.innerHTML = ""; + document.querySelector(".text-wrapper").appendChild(c); }; function scroll() { - document.querySelector(".text-wrapper").style.transition = "top 0.5s ease"; - document.querySelector(".text-wrapper").style.top = "-50px"; - setTimeout(switchit, 510) + document.querySelector(".text-wrapper").style.transition = "top 0.5s ease"; + document.querySelector(".text-wrapper").style.top = "-50px"; + setTimeout(switchit, 510) }; function chgtext(tex) { - var c = document.querySelector(".text-wrapper").lastElementChild.innerHTML = tex; - scroll(); + var c = document.querySelector(".text-wrapper").lastElementChild.innerHTML = tex; + scroll(); }; -$(document).ready(function() { - $(".fadein").fadeIn(1250); +$(document).ready(function () { + $(".fadein").fadeIn(1250); }); -$("#signin").on("click", function() { - $(".signinmenu").slideDown(); - } ); +$("#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) \ No newline at end of file diff --git a/public/index.html b/public/index.html index bb4600b..338f9d5 100644 --- a/public/index.html +++ b/public/index.html @@ -1,50 +1,55 @@ - - - AstroCom - - - - - - - - - - - - - + -
-
-

AstroCom

-
-
-
...
-
-
-
-


- -
-
- Sign In -
-
- User Panel -
Admin Login -
-
+
+
+

AstroCom

+
+
+
+
+
+
+


+ +
+
+ Sign In +
+
+ User Panel +
Admin Login +
+
- + + \ No newline at end of file