Skip to content

Commit

Permalink
spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
divinsmathew committed May 22, 2021
1 parent 8eb5641 commit 15df9b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,7 @@ nav {
}
.windows8 {
position: relative;
top: -18px;
width: 54px;
height: 54px;
margin: auto;
Expand Down
14 changes: 7 additions & 7 deletions js/cowatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ function fillDistricts()

async function refreshTable(renderFilter)
{
setLoading(true)
setVisibility("spinner")
let watchDistrictId = districtsSelect.value
let todayString = getTodayString()

Expand Down Expand Up @@ -180,9 +180,8 @@ function main(data, renderFilter)
previousSessionCountMap.clear()
let currentDistrict = districtsSelect.options[districtsSelect.selectedIndex].text

notFoundImgContainer.style.display = "grid"
availabilityText.innerHTML = "<span class='nonEmph'> Vaccines available in <span class='emph'>0/0</span> vaccination centres.</span>"
setLoading(false, false)
setVisibility("notFound")

if (!watching) document.getElementById('watchHeading').innerHTML = "Get pinged when new a vaccination slot becomes available. Press <span class='pop'>Start Watching</span> to start monitoring <span class='pop'>" + currentDistrict + "</span> district."
document.title = "CoWatch | " + currentDistrict
Expand Down Expand Up @@ -226,7 +225,7 @@ function main(data, renderFilter)
}

hospitals.innerHTML = detailsHtml
setLoading(false)
setVisibility("table")

let currentDistrict = districtsSelect.options[districtsSelect.selectedIndex].text
if (!watching) document.getElementById('watchHeading').innerHTML = "Get pinged when new a vaccination slot becomes available. Press <span class='pop'>Start Watching</span> to start monitoring <span class='pop'>" + currentDistrict + "</span> district."
Expand Down Expand Up @@ -416,8 +415,9 @@ function mute()
document.getElementById('muteAlertButton').style.display = "none"
}

function setLoading(makeVisible, setTable = true)
function setVisibility(item)
{
loadingIndicator.style.display = makeVisible ? "block" : "none"
if (setTable) theTable.style.display = makeVisible ? "none" : "block"
theTable.style.display = item === "table" ? "block" : "none"
loadingIndicator.style.display = item === "spinner" ? "block" : "none"
notFoundImgContainer.style.display = item === "notFound" ? "grid" : "none"
}

0 comments on commit 15df9b9

Please sign in to comment.