Skip to content

Commit

Permalink
Merge pull request #202 from Nintails-TF/FE/comments
Browse files Browse the repository at this point in the history
Fe/comments
  • Loading branch information
KyleTait01 authored Feb 2, 2024
2 parents 2c2bb4b + bec810e commit ec714f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
20 changes: 16 additions & 4 deletions fe/js/mapScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ function initializeMap(latitude, longitude) {
mapElement.innerHTML = "<p>There was an error loading the map</p>";
}
}

/*
* Checks for the geolocation
*/
if ("geolocation" in navigator) {
navigator.geolocation.getCurrentPosition((position) => {
initializeMap(position.coords.latitude, position.coords.longitude);
})
}

/*
*Using checkbox elements we can filter the results by interacting with the API.
*/
function submitFilter(){
const filterData = {};
const checkboxes = document.querySelectorAll('input[type="checkbox"]');
Expand All @@ -47,7 +51,6 @@ function submitFilter(){

branchOpts = document.querySelectorAll('input[data-category="branch"]');
atmOpts = document.querySelectorAll('input[data-category="atm"]');

checkboxes.forEach(checkbox => {
if (checkbox.checked){
branchOpts.forEach(opt => {
Expand Down Expand Up @@ -98,6 +101,9 @@ async function filterBranches(filterData){
shadowSize: [41, 41]
});

/*
* Calling the endpoint for branch and atm filter.
*/
try {
for (i = 0; i < 2; i++){
if (i == 0){
Expand Down Expand Up @@ -277,7 +283,9 @@ async function filterBranches(filterData){
console.error("Error fetching data:", error);
}
}

/*
* Makes the list view visible/hidden when interacted with
*/
function toggleListView() {
listView = document.getElementById("list-view");
if (listView.classList.contains("hidden")) {
Expand All @@ -293,6 +301,10 @@ function toggleListView() {
}
}

/*
* Makes the filter box visible/hidden when interacted with
*/

function toggleFilterBox() {
filterBox = document.getElementById("filter-box");

Expand Down
3 changes: 1 addition & 2 deletions fe/map.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="
crossorigin=""
></script>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700&display=swap"
Expand All @@ -30,7 +30,6 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>NCR Branches & ATMs</title>
</head>

<body>
<div class="relative" style="z-index: 20">
<div
Expand Down

0 comments on commit ec714f7

Please sign in to comment.