Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
added save disabling rather than hiding, fixed save errors
Browse files Browse the repository at this point in the history
  • Loading branch information
coltmay committed Mar 19, 2021
1 parent a30ea29 commit acffff8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ <h1>Itinerary Preview</h2>

</aside>
<footer>
<!-- ! FOOTER -->
<button id="saveItinerary">Save Itinerary</button>
</footer>
<script type="module" src="/scripts/main.js"></script>
</body>
Expand Down
19 changes: 3 additions & 16 deletions scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ import { displayPark, showParkDetails } from "./parks/ParkPreview.js"
import { itineraryList } from "./itinerary/ItineraryList.js";
import { createItinerary } from "./data/DataManager.js";

import { displaySave } from "./nav/Footer.js";

// Set Application For Event Bubbling
const applicationElement = document.querySelector("body");
document.getElementById("saveItinerary").disabled = true;

// Event Listener To Test Capture of All Previewed Locations
const saveItinerary = () => {
Expand All @@ -39,8 +38,8 @@ const saveItinerary = () => {
parkPreviewLocation: parkPreviewLocation
};
createItinerary(itineraryObject);
location.reload();
}

})
}

Expand Down Expand Up @@ -106,17 +105,6 @@ parkDetailElement.addEventListener("click", (event) => {
}
})

/*~~~~~~~~~~~~~~~Test Code~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
// const contentElement = document.querySelector("body");
// contentElement.addEventListener("click", event => {
// if (event.target.id === "")
// console.log(event.target.id)
// })


/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//? Drop Down Population

// Display Save Button When Three Selections Are Made
Expand All @@ -125,7 +113,7 @@ const saveCheck = () => {
const attractionContainer = document.querySelector(".attractionCard");
const eateryContainer = document.querySelector(".eateryCard");
if (!(parkContainer.innerHTML === "" || attractionContainer.innerHTML === "" || eateryContainer.innerHTML === "")) {
displaySave();
document.getElementById("saveItinerary").disabled = false;
}
}

Expand All @@ -137,7 +125,6 @@ eateryDetailElement.addEventListener("click", (event) => {
for (let anEatery of eateryListArray) {
// Although value is a number, it is presented as a string in EateryPreview.js / parseInt converts it to an integer
if (anEatery.id === parseInt(event.target.value)) {

showEateryDetails(anEatery)
}
}
Expand Down
7 changes: 0 additions & 7 deletions scripts/nav/Footer.js

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/parks/ParkPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ export const displayPark = (parkObj) => {
const contentElement = document.querySelector(".parkCard")

let parkDisplay = `
<h2>${parkObj.fullName}</h2>
<p>${parkObj.addresses[0].city}, ${parkObj.states}</p><br>
<h2 id="parkName">${parkObj.fullName}</h2>
<p id="parkLocation">${parkObj.addresses[0].city}, ${parkObj.states}</p><br>
<p> <a href="${parkObj.url}">Visit the ${parkObj.fullName} official website!</a> </p><br>
<latitude id="parkLat" value="${parkObj.latitude}"></latitude>
<longitude id="parkLng" value="${parkObj.longitude}"></longitude>
Expand Down

0 comments on commit acffff8

Please sign in to comment.