🐄🚞 Checkpoint
./public/index.js:1954897/59401
This commit is contained in:
1 parent
6598bcd297
commit
ec7755bfa5
1 file changed
+9
-5
+9
-5
@@ -33,7 +33,7 @@ const data = getData()
|
||||
const map = L.map('map', {
|
||||
minZoom: 15,
|
||||
maxZoom: 18
|
||||
}).setView([32.98649, -96.7485], 18)
|
||||
}).setView([32.98613, -96.75042], 18)
|
||||
|
||||
|
||||
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw', {
|
||||
@@ -71,7 +71,7 @@ setTimeout(drawRegions, 60 * 1000)
|
||||
async function drawRegions() {
|
||||
const data = await getData()
|
||||
|
||||
const ecsw = data.filter(d => d.loc === 'ECSW')
|
||||
const ecsw = data.filter(d => d.loc === 'ECSW' && Date.now() - d.time < 60 * 60 * 1000)
|
||||
|
||||
console.log(ecsw)
|
||||
|
||||
@@ -95,7 +95,7 @@ function getData() {
|
||||
|
||||
|
||||
async function displayCard(id) {
|
||||
const data = (await getData()).filter(d => d.loc === id)
|
||||
const data = (await getData()).filter(d => d.loc === id && Date.now() - d.time < 60 * 60 * 1000)
|
||||
const card = document.getElementById("card")
|
||||
await card.animate([
|
||||
{ transform: 'translateY(50px)', opacity: "0" },
|
||||
@@ -115,9 +115,13 @@ async function displayCard(id) {
|
||||
|
||||
console.log({ avg, current, delta, busy, color })
|
||||
|
||||
const msg = Number.isNaN(delta)
|
||||
? "No data..."
|
||||
: (busy ? "Busier than usual": "Not as busy :)")
|
||||
|
||||
card.innerHTML = `
|
||||
<h1>${buildings[id].name}</h1>
|
||||
<p>${busy ? "Busier than usual" : "Not as busy :)"}</p>
|
||||
<p>${msg}</p>
|
||||
<canvas id="myChart" height="80"></canvas>
|
||||
`
|
||||
card.style.setProperty("--region", `'${id}'`)
|
||||
@@ -134,7 +138,7 @@ async function displayCard(id) {
|
||||
|
||||
function updateChart(data) {
|
||||
const parsed = data.map(d => {
|
||||
const TEN_MINUTES = 1 * 60 * 1000
|
||||
const TEN_MINUTES = 10 * 60 * 1000
|
||||
// this is 0-5
|
||||
let ago = Math.floor((Date.now() - d.time) / TEN_MINUTES)
|
||||
// if (20 < ago) ago = 20
|
||||
|
||||
Reference in new issue
Block a user