From 921200885215764e50ffbaa32028f63dabc518f6 Mon Sep 17 00:00:00 2001 From: Melinda T Date: Tue, 11 Jun 2024 16:58:34 -0700 Subject: [PATCH] edit to match new-layout api, added disclaimer. right now includes hard coded zip9 --- src/vis/MeasurementMap.tsx | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/vis/MeasurementMap.tsx b/src/vis/MeasurementMap.tsx index ac91de1..170c257 100644 --- a/src/vis/MeasurementMap.tsx +++ b/src/vis/MeasurementMap.tsx @@ -67,8 +67,8 @@ function searchEventHandler(result: any): void { + "&street_number=" + parsedAddr.street + "&st=" + parsedAddr.type + "&post_direction=" + post_direction - + "&zip_5=" + postcode; - // + "&zip_9=" + "3207"; + + "&zip_5=" + postcode + + "&zip_9=" + "3207"; console.log(url); @@ -80,7 +80,7 @@ function searchEventHandler(result: any): void { console.log(xhr.status); if (xhr.status === 200) { //result.marker.setPopupContent(xhr.responseText); - result.marker.setPopupContent(organizePopup(xhr.responseText)); + result.marker.setPopupContent(organizePopup(xhr.responseText, postcode)); } }; xhr.send(); @@ -89,9 +89,9 @@ function searchEventHandler(result: any): void { // organize popup content. called from searchEvenHandler -function organizePopup(apiText: any): string{ +function organizePopup(apiText: any, postcode: any): string{ let dict = JSON.parse(apiText); - //console.log(dict); + console.log(dict); let returnString = "" + "" + "" + "" @@ -102,11 +102,11 @@ function organizePopup(apiText: any): string{ if ("message" in dict) { return dict["message"]; } - let dict2 = dict["here you go"]; - console.log(dict2); + //let dict2 = dict["here you go"]; + //console.log(dict2); // for loop that goes over each key in dictionary - for (let key in dict2) { + for (let key in dict) { /*returnString = returnString + "" + key + "" + ": Available speeds up to " + dict2[key]["Available speeds"] + ", Starting at " + dict2[key]["Starting at"] + "
" + "
";*/ let keyName = key; @@ -116,13 +116,18 @@ function organizePopup(apiText: any): string{ } returnString += "
" + "" - + "" - + "" + + "" + + "" + ""; } - return returnString + "
" + "Provider" + "
" + keyName + "" + dict2[key]["Available speeds"] + "" + dict2[key]["Starting at"] + "" + dict[key]["Available speeds"] + "" + dict[key]["Starting at"] + "
"; + returnString = returnString + ""; + returnString = returnString + "

"+ "Disclaimer: The table above shows a general estimate of the rates and providers in your area, using information from these sources: " + + "
" + "allconnect.com" + + "
" + "FCC National Broadband Map." + + "

"; + return returnString; } // make request/call to api, then get back the json data,