Skip to content

Commit

Permalink
Update main.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthmoog authored Aug 12, 2024
1 parent bc2b8b8 commit a135c4e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const commentBox = document.getElementById("commentText");
const commentSaveButton = document.getElementById("saveComment");
const discardCommentButton = document.getElementById("discardComment");

const transectToggleButton = document.getElementById("toggleTransect");
const coalDropsSections = document.getElementById("coalDropsYard");

const speciesSelection = document.getElementById("species");
const clearButton = document.getElementById("clear");

Expand All @@ -52,10 +55,16 @@ saveButton.hidden = true;
commentBox.hidden = true;
commentSaveButton.hidden = true;
discardCommentButton.hidden = true;
coalDropsSections.hidden = true;

renderSummary();
renderMetaData();

transectToggleButton.addEventListener("click", () => {
toggleTransect();
renderMetaData();
})

startButton.addEventListener("click", () => {
startBeeWalk();
renderMetaData();
Expand Down Expand Up @@ -130,6 +139,16 @@ function makeMetaDataEditable(isEditable) {
saveButton.hidden = !isEditable;
}

function toggleTransect() {
// show the relevant sections
coalDropsSections.hidden = !coalDropsSections.hidden;

// update label
let labelText = transectToggleButton.innerText;
labelText === "Castle Hill" ? labelText = "Coal Drops Yard" : labelText = "Castle Hill";
transectToggleButton.innerText = labelText;
}

function startBeeWalk() {
walkData.hidden = false;
function error() {
Expand All @@ -138,6 +157,7 @@ function startBeeWalk() {
}

setStartDateTime();
setTransect();

navigator.geolocation.getCurrentPosition(async (location) => {
const weather = await fetchWeather(location) //todo: maybe this should just return
Expand Down

0 comments on commit a135c4e

Please sign in to comment.