Skip to content

Commit

Permalink
places reviewed
Browse files Browse the repository at this point in the history
  • Loading branch information
ronan-s1 committed Feb 6, 2024
1 parent f963fe7 commit 039da93
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
8 changes: 8 additions & 0 deletions assets/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ body{
text-decoration: underline;
}

#placesReviewed {
color: #ff8c00;
}


.carousel {
max-width: 100%;
Expand All @@ -138,6 +142,10 @@ body{
border-radius: 0px !important;
}

.places-reviewed {
color: #c5761b;
font-weight: bold;
}

footer {
text-align: center;
Expand Down
16 changes: 16 additions & 0 deletions assets/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Call a function to display the data
displayFoodList(data);
populateCategoryFilter(data);
updatePlacesReviewed(data);
})
.catch(error => console.error("Error fetching data:", error));

Expand Down Expand Up @@ -178,4 +179,19 @@ document.addEventListener("DOMContentLoaded", function () {
displayFoodList(foodList);
});
}

function updatePlacesReviewed(foodList) {
const placesReviewedSpan = document.getElementById("placesReviewed");
placesReviewedSpan.textContent = countReviewedPlaces(foodList);
}

// Function to count the reviewed places
function countReviewedPlaces(foodList) {
return foodList.reduce((count, item) => {
if (item.category !== "PENDING") {
count++;
}
return count;
}, 0);
}
});
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ <h1>OFFICIAL DUBLIN FOOD HITLIST 🍔🍔🍔</h1>
<div class="row">
<div class="col-md-7 px-0">
<input type="text" id="searchBar" class="form-control" placeholder="Search">
<p class="places-reviewed mt-1">Places Reviewed: <span id="placesReviewed"></span></p>
</div>
<div class="col-md-3 px-0">
<select id="categoryFilter" class="form-select">
Expand Down

0 comments on commit 039da93

Please sign in to comment.