diff --git a/cloud_functions/search_handler.py b/cloud_functions/search_handler.py index 605740f..8bb31ff 100644 --- a/cloud_functions/search_handler.py +++ b/cloud_functions/search_handler.py @@ -15,19 +15,19 @@ def _miles_away(lat_lng_a, lat_lng_b): def _vaccine_stats(df): return dict( locations_count = int(df['NAME'].count()), - total_available = int(df['VACCINES_AVAILABLE'].sum()), pfizer_available = int(df['PFIZER_AVAILABLE'].sum()), moderna_available = int(df['MODERNA_AVAILABLE'].sum()), - jj_available = int(df['JJ_AVAILABLE'].sum()) + jj_available = int(df['JJ_AVAILABLE'].sum()), + total_available = int(df['VACCINES_AVAILABLE'].sum()) ) def _location_stats(df): stats = df.groupby(['TYPE']).agg( locations_count=('NAME','count'), - total_available=('VACCINES_AVAILABLE','sum'), pfizer_available=('PFIZER_AVAILABLE','sum'), moderna_available=('MODERNA_AVAILABLE','sum'), - jj_available=('JJ_AVAILABLE','sum') + jj_available=('JJ_AVAILABLE','sum'), + total_available=('VACCINES_AVAILABLE','sum') ).reset_index() return stats.to_dict(orient='records') diff --git a/site/src/app.css b/site/src/app.css index 526329d..62c645f 100644 --- a/site/src/app.css +++ b/site/src/app.css @@ -29,6 +29,8 @@ td, th { /* table stuff end */ +/* layout */ + .container { flex-direction: column; height: 100%; @@ -37,14 +39,25 @@ td, th { padding: 30px 50px 50px 50px; } +.navbar { + width: 100%; + height: 100px; +} + .main { - margin-top: 100px; - height: 60vh; - justify-content: center; + margin-top: 25px; + /* height: 60vh; */ + /* justify-content: center; */ /* overflow-x: scroll; overflow-y: scroll; */ } +/* layout end */ + +.summary-container { + font-size: 18px; +} + .logoContainer { height: 60vh; @@ -59,6 +72,7 @@ td, th { .formContainer { width: 100%; + margin: 1rem; } .subscribe-form { @@ -74,27 +88,24 @@ td, th { margin-top: 12px; } -.navbar { - width: 100%; - height: 100px; -} -/* Menu */ -.menuContainer { +/* Nav */ + +/* .menuContainer { display: flex; flex-direction: column; align-items: center; justify-content: center; -} +} */ -.menuLogoContainer { +/* .menuLogoContainer { width: 100%; justify-content: center; -} +} */ -.menuLinkContainer { +.navbar-links-container { display: flex; flex-direction: row; justify-content: space-evenly; @@ -104,11 +115,11 @@ td, th { margin: 10px 0 30px 0; } -.menuLink { +.navbar-link { margin: 10px 20px; text-decoration: none; text-transform: uppercase; - color: #fff; + color: #fff im !important; } .menuLogo { diff --git a/site/src/fragments/AvailabilitySummary.js b/site/src/fragments/AvailabilitySummary.js new file mode 100644 index 0000000..7b72a93 --- /dev/null +++ b/site/src/fragments/AvailabilitySummary.js @@ -0,0 +1,15 @@ +import React from "react"; + +export default function AvailabilitySummary({ data }) { + const keys = data && Object.keys(data) + console.log(data); + console.log(keys); + return ( +
+ {data && keys.map((key) =>
+
{data[key]}
+
{key}
+
)} +
+ ) +} \ No newline at end of file diff --git a/site/src/fragments/Datatable.js b/site/src/fragments/Datatable.js index 0129bad..ad14339 100644 --- a/site/src/fragments/Datatable.js +++ b/site/src/fragments/Datatable.js @@ -1,15 +1,29 @@ import React from "react"; +function drawTd(val){ + if (val == 0) { + return '-' + } else { + return val + } +} + +function getUnits(col) { + if (col =='miles_away') { + return ' mi.' + } +} + export default function Datatable({ data }) { const columns = data[0] && Object.keys(data[0]) - return + return
{data[0] && columns.map((heading) => )} {data.map(row => { - columns.map(column => ) + columns.map(column => ) } )} diff --git a/site/src/pages/Search.js b/site/src/pages/Search.js index 6941b7e..4a5bb63 100644 --- a/site/src/pages/Search.js +++ b/site/src/pages/Search.js @@ -1,25 +1,24 @@ import React, { useState, useEffect } from 'react'; import {withRouter} from 'react-router-dom' -import axios from 'axios' import Nav from '../fragments/Nav' import Datatable from '../fragments/Datatable'; - +import AvailabilitySummary from '../fragments/AvailabilitySummary'; +import PromptForm from '../fragments/PromptForm'; function Search() { const [data, setData] = useState({ 'locations': [], - 'location_stats': {}, + 'location_stats': [], 'vax_stats': {}, }); - - const params = { + const [params, setParams] = useState({ 'zip_': '78741', - 'radius': 100 - } - + 'radius': 50 + }); + const apiBase = 'https://p6ccqa7dik.execute-api.us-east-1.amazonaws.com/dev' const searchEndpoint = `${apiBase}/search` @@ -37,7 +36,14 @@ function Search() {
);
{heading}
{row[column]}{drawTd(row[column])}{getUnits(column)}