From 093f54ae949a2d9a8e7ab3762f2a6427112a3fb8 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Fri, 26 Jun 2020 06:56:25 -0600 Subject: [PATCH 01/27] add config file with API endpoint, import new enpoint into index.js --- frontend/config.js | 3 +++ frontend/pages/index.js | 9 ++++----- frontend/public/vercel.svg | 4 ---- 3 files changed, 7 insertions(+), 9 deletions(-) create mode 100644 frontend/config.js delete mode 100644 frontend/public/vercel.svg diff --git a/frontend/config.js b/frontend/config.js new file mode 100644 index 0000000..5f638f6 --- /dev/null +++ b/frontend/config.js @@ -0,0 +1,3 @@ +export default { + API_ENDPOINT: 'https://energy-assistance-dashboard.herokuapp.com' +} \ No newline at end of file diff --git a/frontend/pages/index.js b/frontend/pages/index.js index cca1e12..52d3d67 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -5,8 +5,7 @@ import ParetoChart from '../components/ParetoChart'; import HouseholdsAssisted from '../components/HouseholdsAssisted'; import ParticipantsChart from '../components/ParticipantsChart'; import styles from '../styles/global.module.css' - -const frontendUrl = 'https://energy-assistance-dashboard.herokuapp.com'; +import config from '../config' class Index extends React.Component { constructor(props) { @@ -19,7 +18,7 @@ class Index extends React.Component { getCountyId = (e) => { e.preventDefault(); const id = e.target.value; - fetch(`${frontendUrl}/counties/${id}`) + fetch(`${config.API_ENDPOINT}/counties/${id}`) .then(res => res.json()) .then(data => { this.setState({ @@ -157,11 +156,11 @@ class Index extends React.Component { Index.getInitialProps = async function() { //req to GET specific county data - const res = await fetch(`${frontendUrl}/counties/0`); + const res = await fetch(`${config.API_ENDPOINT}/counties/0`); const data = await res.json(); //req to GET all counties - const countyRes = await fetch(`${frontendUrl}/counties`); + const countyRes = await fetch(`${config.API_ENDPOINT}/counties`); const countyList = await countyRes.json(); return { diff --git a/frontend/public/vercel.svg b/frontend/public/vercel.svg deleted file mode 100644 index fbf0e25..0000000 --- a/frontend/public/vercel.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - \ No newline at end of file From 8c391f7d02e827266982fcaebafd24cb4b18f151 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Fri, 26 Jun 2020 07:21:38 -0600 Subject: [PATCH 02/27] set up conditional to change api url in prod vs dev --- frontend/config.js | 4 +++- frontend/pages/index.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/config.js b/frontend/config.js index 5f638f6..d16ec09 100644 --- a/frontend/config.js +++ b/frontend/config.js @@ -1,3 +1,5 @@ export default { - API_ENDPOINT: 'https://energy-assistance-dashboard.herokuapp.com' + API_ENDPOINT: process.env.NODE_ENV === ('production') + ? 'https://energy-assistance-dashboard.herokuapp.com' + : 'http://127.0.0.1:8000/', } \ No newline at end of file diff --git a/frontend/pages/index.js b/frontend/pages/index.js index 52d3d67..6892ff2 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -29,6 +29,7 @@ class Index extends React.Component { } render() { + console.log(process.env.NODE_ENV) const selectedCountyData = this.state.selectedCountyData.data return (
From 5c1564d7f97c169fa0b8d99f37163edaa139ef6f Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 29 Jun 2020 17:41:29 -0600 Subject: [PATCH 03/27] get routes to pull data from api --- frontend/config.js | 5 ----- frontend/next.config.js | 8 ++++++++ frontend/pages/api/counties.js | 9 ++++++--- frontend/pages/api/counties/[id].js | 7 +++++-- frontend/pages/index.js | 12 ++++++------ 5 files changed, 25 insertions(+), 16 deletions(-) delete mode 100644 frontend/config.js create mode 100644 frontend/next.config.js diff --git a/frontend/config.js b/frontend/config.js deleted file mode 100644 index d16ec09..0000000 --- a/frontend/config.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - API_ENDPOINT: process.env.NODE_ENV === ('production') - ? 'https://energy-assistance-dashboard.herokuapp.com' - : 'http://127.0.0.1:8000/', -} \ No newline at end of file diff --git a/frontend/next.config.js b/frontend/next.config.js new file mode 100644 index 0000000..b2c348b --- /dev/null +++ b/frontend/next.config.js @@ -0,0 +1,8 @@ +module.exports = { + env: { + // API_ENDPOINT: process.env.NODE_ENV === ('production') + // ? process.env.NEXT_PUBLIC_API_ENDPOINT + // : 'http://127.0.0.1:8000/', + API_ENDPOINT: 'https://energy-assistance-dashboard.herokuapp.com' + }, + } \ No newline at end of file diff --git a/frontend/pages/api/counties.js b/frontend/pages/api/counties.js index fde2fa1..e32de05 100644 --- a/frontend/pages/api/counties.js +++ b/frontend/pages/api/counties.js @@ -1,7 +1,10 @@ -export default (req, res) => { + +export default async (req, res) => { // ! TODO: Connect to backend - res.statusCode = 200 - res.json({"counties":{"0":"COLORADO STATE","1":"ADAMS COUNTY","3":"ALAMOSA COUNTY","5":"ARAPAHOE COUNTY","7":"ARCHULETA COUNTY","9":"BACA COUNTY","11":"BENT COUNTY","13":"BOULDER COUNTY","14":"BROOMFIELD COUNTY","15":"CHAFFEE COUNTY","17":"CHEYENNE COUNTY","19":"CLEAR CREEK COUNTY","21":"CONEJOS COUNTY","23":"COSTILLA COUNTY","25":"CROWLEY COUNTY","27":"CUSTER COUNTY","29":"DELTA COUNTY","31":"DENVER COUNTY","33":"DOLORES COUNTY","35":"DOUGLAS COUNTY","37":"EAGLE COUNTY","39":"ELBERT COUNTY","41":"EL PASO COUNTY","43":"FREMONT COUNTY","45":"GARFIELD COUNTY","47":"GILPIN COUNTY","49":"GRAND COUNTY","51":"GUNNISON COUNTY","53":"HINSDALE COUNTY","55":"HUERFANO COUNTY","57":"JACKSON COUNTY","59":"JEFFERSON COUNTY","61":"KIOWA COUNTY","63":"KIT CARSON COUNTY","65":"LAKE COUNTY","67":"LA PLATA COUNTY","69":"LARIMER COUNTY","71":"LAS ANIMAS COUNTY","73":"LINCOLN COUNTY","75":"LOGAN COUNTY","77":"MESA COUNTY","79":"MINERAL COUNTY","81":"MOFFAT COUNTY","83":"MONTEZUMA COUNTY","85":"MONTROSE COUNTY","87":"MORGAN COUNTY","89":"OTERO COUNTY","91":"OURAY COUNTY","93":"PARK COUNTY","95":"PHILLIPS COUNTY","97":"PITKIN COUNTY","99":"PROWERS COUNTY","101":"PUEBLO COUNTY","103":"RIO BLANCO COUNTY","105":"RIO GRANDE COUNTY","107":"ROUTT COUNTY","109":"SAGUACHE COUNTY","111":"SAN JUAN COUNTY","113":"SAN MIGUEL COUNTY","115":"SEDGWICK COUNTY","117":"SUMMIT COUNTY","119":"TELLER COUNTY","121":"WASHINGTON COUNTY","123":"WELD COUNTY","125":"YUMA COUNTY"}}) + const backendURL = process.env.API_ENDPOINT; + const countyRes = await fetch(`${backendURL}/counties`); + const data = await countyRes.json(); + res.status(200).json({ data: data }) } diff --git a/frontend/pages/api/counties/[id].js b/frontend/pages/api/counties/[id].js index adb7dfb..074d788 100644 --- a/frontend/pages/api/counties/[id].js +++ b/frontend/pages/api/counties/[id].js @@ -1,7 +1,10 @@ -export default (req, res) => { +export default async (req, res) => { // ! TODO: Connect to backend const { query: { id } } = req - res.json({"message":"Returning county data","data":{"2010":{"Population":578087,"Households":254181,"Average Household Size":2.23,"Median Household Income":45501,"Households below 200% FPL":99021,"% Households below 200% FPL":0.39,"EA Participants":"3594","LEAP Participants":"15926","Total Households Assisted":19520,"% of Households below 200% FPL Assisted":0.2},"2011":{"Population":590507,"Households":258132,"Average Household Size":2.24,"Median Household Income":47499,"Households below 200% FPL":99932,"% Households below 200% FPL":0.39,"EA Participants":"2957","LEAP Participants":"12937","Total Households Assisted":15894,"% of Households below 200% FPL Assisted":0.16},"2012":{"Population":604356,"Households":261836,"Average Household Size":2.26,"Median Household Income":49091,"Households below 200% FPL":101707,"% Households below 200% FPL":0.39,"EA Participants":"4530","LEAP Participants":"12509","Total Households Assisted":17039,"% of Households below 200% FPL Assisted":0.17},"2013":{"Population":619297,"Households":266069,"Average Household Size":2.27,"Median Household Income":50313,"Households below 200% FPL":103765,"% Households below 200% FPL":0.39,"EA Participants":"3232","LEAP Participants":"11264","Total Households Assisted":14496,"% of Households below 200% FPL Assisted":0.14},"2014":{"Population":633777,"Households":271054,"Average Household Size":2.28,"Median Household Income":51800,"Households below 200% FPL":104129,"% Households below 200% FPL":0.38,"EA Participants":"3479","LEAP Participants":"10019","Total Households Assisted":13498,"% of Households below 200% FPL Assisted":0.13},"2015":{"Population":649654,"Households":275795,"Average Household Size":2.3,"Median Household Income":53637,"Households below 200% FPL":101261,"% Households below 200% FPL":0.37,"EA Participants":"3779","LEAP Participants":"8874","Total Households Assisted":12653,"% of Households below 200% FPL Assisted":0.12},"2016":{"Population":663303,"Households":281072,"Average Household Size":2.31,"Median Household Income":56258,"Households below 200% FPL":98956,"% Households below 200% FPL":0.35,"EA Participants":"3168","LEAP Participants":"8313","Total Households Assisted":11481,"% of Households below 200% FPL Assisted":0.12},"2017":{"Population":678467,"Households":287262,"Average Household Size":2.31,"Median Household Income":60098,"Households below 200% FPL":95839,"% Households below 200% FPL":0.33,"EA Participants":"3236","LEAP Participants":"7432","Total Households Assisted":10668,"% of Households below 200% FPL Assisted":0.11},"2018":{"Population":693417,"Households":294358,"Average Household Size":2.31,"Median Household Income":63793,"Households below 200% FPL":92530,"% Households below 200% FPL":0.31,"EA Participants":"3181","LEAP Participants":"7160","Total Households Assisted":10341,"% of Households below 200% FPL Assisted":0.11}},"last_updated":"18:33:20"}) + const backendURL = process.env.API_ENDPOINT; + const countyDataRes = await fetch(`${backendURL}/counties/${id}`); + const data = await countyDataRes.json(); + res.status(200).json({ data: data }) } diff --git a/frontend/pages/index.js b/frontend/pages/index.js index 6892ff2..1e3f32a 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -5,7 +5,8 @@ import ParetoChart from '../components/ParetoChart'; import HouseholdsAssisted from '../components/HouseholdsAssisted'; import ParticipantsChart from '../components/ParticipantsChart'; import styles from '../styles/global.module.css' -import config from '../config' + +const backendURL = process.env.API_ENDPOINT; class Index extends React.Component { constructor(props) { @@ -18,7 +19,7 @@ class Index extends React.Component { getCountyId = (e) => { e.preventDefault(); const id = e.target.value; - fetch(`${config.API_ENDPOINT}/counties/${id}`) + fetch(`${backendURL}/counties/${id}`) .then(res => res.json()) .then(data => { this.setState({ @@ -29,7 +30,6 @@ class Index extends React.Component { } render() { - console.log(process.env.NODE_ENV) const selectedCountyData = this.state.selectedCountyData.data return (
@@ -155,13 +155,13 @@ class Index extends React.Component { } } -Index.getInitialProps = async function() { +Index.getInitialProps = async function({ params }) { //req to GET specific county data - const res = await fetch(`${config.API_ENDPOINT}/counties/0`); + const res = await fetch(`${backendURL}/counties/0`); const data = await res.json(); //req to GET all counties - const countyRes = await fetch(`${config.API_ENDPOINT}/counties`); + const countyRes = await fetch(`${backendURL}/counties`); const countyList = await countyRes.json(); return { From b4f2b1f62160f4723c31437ea99cac1f4fcbf73c Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Tue, 30 Jun 2020 17:52:41 -0600 Subject: [PATCH 04/27] add full stats component --- frontend/components/FullStats.js | 31 +++++++++++++---------------- frontend/pages/api/counties.js | 13 ++++-------- frontend/pages/api/counties/[id].js | 11 +++------- frontend/pages/api/hello.js | 6 ------ frontend/styles/global.module.css | 12 +++++++---- frontend/utils/utilities.js | 6 ++++-- 6 files changed, 33 insertions(+), 46 deletions(-) delete mode 100644 frontend/pages/api/hello.js diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index 8e67019..589a866 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -1,21 +1,18 @@ import styles from '../styles/global.module.css' -import { formatNumber } from '../utils/utilities' +import { formatCellData } from '../utils/utilities' const FullStats = (props) => { - const availableYears = Object.keys(props.selectedCountyData).reverse(); - const countyData = availableYears.map(key => { - return { [key]: props.selectedCountyData[key] }; - }); - - const itemKeys = Object.keys(countyData[0]['2019']); + const selectedCountyData = props.selectedCountyData; + const availableYears = Object.keys(selectedCountyData).reverse(); + const itemKeys = Object.keys(selectedCountyData[availableYears[0]]); const tableData = itemKeys.map(key => { - const values = availableYears.map(item => props.selectedCountyData[item][key] ); + const values = availableYears.map(item => selectedCountyData[item][key] ); return { [key] : [...values] } }); return ( -
+

Full Stats

@@ -28,17 +25,17 @@ const FullStats = (props) => { })} - { props.selectedCountyData - ? ( + { selectedCountyData + ? ( { tableData.map(item => { - const topValue = Object.keys(item)[0] - const tableValues = Object.values(item)[0] + const cellData = Object.entries(item)[0]; return ( - - { tableValues.map(value => { + + { cellData[1].map(value => { + let val = value ? value : 0 return ( - + ) })} @@ -47,7 +44,7 @@ const FullStats = (props) => { ) : ( - + ) diff --git a/frontend/pages/api/counties.js b/frontend/pages/api/counties.js index e32de05..b624aac 100644 --- a/frontend/pages/api/counties.js +++ b/frontend/pages/api/counties.js @@ -1,10 +1,5 @@ - -export default async (req, res) => { +export default (req, res) => { // ! TODO: Connect to backend - const backendURL = process.env.API_ENDPOINT; - const countyRes = await fetch(`${backendURL}/counties`); - const data = await countyRes.json(); - res.status(200).json({ data: data }) -} - - + res.statusCode = 200 + res.json({"counties":{"0":"COLORADO STATE","1":"ADAMS COUNTY","3":"ALAMOSA COUNTY","5":"ARAPAHOE COUNTY","7":"ARCHULETA COUNTY","9":"BACA COUNTY","11":"BENT COUNTY","13":"BOULDER COUNTY","14":"BROOMFIELD COUNTY","15":"CHAFFEE COUNTY","17":"CHEYENNE COUNTY","19":"CLEAR CREEK COUNTY","21":"CONEJOS COUNTY","23":"COSTILLA COUNTY","25":"CROWLEY COUNTY","27":"CUSTER COUNTY","29":"DELTA COUNTY","31":"DENVER COUNTY","33":"DOLORES COUNTY","35":"DOUGLAS COUNTY","37":"EAGLE COUNTY","39":"ELBERT COUNTY","41":"EL PASO COUNTY","43":"FREMONT COUNTY","45":"GARFIELD COUNTY","47":"GILPIN COUNTY","49":"GRAND COUNTY","51":"GUNNISON COUNTY","53":"HINSDALE COUNTY","55":"HUERFANO COUNTY","57":"JACKSON COUNTY","59":"JEFFERSON COUNTY","61":"KIOWA COUNTY","63":"KIT CARSON COUNTY","65":"LAKE COUNTY","67":"LA PLATA COUNTY","69":"LARIMER COUNTY","71":"LAS ANIMAS COUNTY","73":"LINCOLN COUNTY","75":"LOGAN COUNTY","77":"MESA COUNTY","79":"MINERAL COUNTY","81":"MOFFAT COUNTY","83":"MONTEZUMA COUNTY","85":"MONTROSE COUNTY","87":"MORGAN COUNTY","89":"OTERO COUNTY","91":"OURAY COUNTY","93":"PARK COUNTY","95":"PHILLIPS COUNTY","97":"PITKIN COUNTY","99":"PROWERS COUNTY","101":"PUEBLO COUNTY","103":"RIO BLANCO COUNTY","105":"RIO GRANDE COUNTY","107":"ROUTT COUNTY","109":"SAGUACHE COUNTY","111":"SAN JUAN COUNTY","113":"SAN MIGUEL COUNTY","115":"SEDGWICK COUNTY","117":"SUMMIT COUNTY","119":"TELLER COUNTY","121":"WASHINGTON COUNTY","123":"WELD COUNTY","125":"YUMA COUNTY"}}) +} \ No newline at end of file diff --git a/frontend/pages/api/counties/[id].js b/frontend/pages/api/counties/[id].js index 074d788..8a980ab 100644 --- a/frontend/pages/api/counties/[id].js +++ b/frontend/pages/api/counties/[id].js @@ -1,10 +1,5 @@ -export default async (req, res) => { +export default (req, res) => { // ! TODO: Connect to backend const { query: { id } } = req - const backendURL = process.env.API_ENDPOINT; - const countyDataRes = await fetch(`${backendURL}/counties/${id}`); - const data = await countyDataRes.json(); - res.status(200).json({ data: data }) -} - - + res.json({"message":"Returning county data","data":{"2010":{"Population":578087,"Households":254181,"Average Household Size":2.23,"Median Household Income":45501,"Households below 200% FPL":99021,"% Households below 200% FPL":0.39,"EA Participants":"3594","LEAP Participants":"15926","Total Households Assisted":19520,"% of Households below 200% FPL Assisted":0.2},"2011":{"Population":590507,"Households":258132,"Average Household Size":2.24,"Median Household Income":47499,"Households below 200% FPL":99932,"% Households below 200% FPL":0.39,"EA Participants":"2957","LEAP Participants":"12937","Total Households Assisted":15894,"% of Households below 200% FPL Assisted":0.16},"2012":{"Population":604356,"Households":261836,"Average Household Size":2.26,"Median Household Income":49091,"Households below 200% FPL":101707,"% Households below 200% FPL":0.39,"EA Participants":"4530","LEAP Participants":"12509","Total Households Assisted":17039,"% of Households below 200% FPL Assisted":0.17},"2013":{"Population":619297,"Households":266069,"Average Household Size":2.27,"Median Household Income":50313,"Households below 200% FPL":103765,"% Households below 200% FPL":0.39,"EA Participants":"3232","LEAP Participants":"11264","Total Households Assisted":14496,"% of Households below 200% FPL Assisted":0.14},"2014":{"Population":633777,"Households":271054,"Average Household Size":2.28,"Median Household Income":51800,"Households below 200% FPL":104129,"% Households below 200% FPL":0.38,"EA Participants":"3479","LEAP Participants":"10019","Total Households Assisted":13498,"% of Households below 200% FPL Assisted":0.13},"2015":{"Population":649654,"Households":275795,"Average Household Size":2.3,"Median Household Income":53637,"Households below 200% FPL":101261,"% Households below 200% FPL":0.37,"EA Participants":"3779","LEAP Participants":"8874","Total Households Assisted":12653,"% of Households below 200% FPL Assisted":0.12},"2016":{"Population":663303,"Households":281072,"Average Household Size":2.31,"Median Household Income":56258,"Households below 200% FPL":98956,"% Households below 200% FPL":0.35,"EA Participants":"3168","LEAP Participants":"8313","Total Households Assisted":11481,"% of Households below 200% FPL Assisted":0.12},"2017":{"Population":678467,"Households":287262,"Average Household Size":2.31,"Median Household Income":60098,"Households below 200% FPL":95839,"% Households below 200% FPL":0.33,"EA Participants":"3236","LEAP Participants":"7432","Total Households Assisted":10668,"% of Households below 200% FPL Assisted":0.11},"2018":{"Population":693417,"Households":294358,"Average Household Size":2.31,"Median Household Income":63793,"Households below 200% FPL":92530,"% Households below 200% FPL":0.31,"EA Participants":"3181","LEAP Participants":"7160","Total Households Assisted":10341,"% of Households below 200% FPL Assisted":0.11}},"last_updated":"18:33:20"}) +} \ No newline at end of file diff --git a/frontend/pages/api/hello.js b/frontend/pages/api/hello.js deleted file mode 100644 index 5b77ec0..0000000 --- a/frontend/pages/api/hello.js +++ /dev/null @@ -1,6 +0,0 @@ -// Next.js API route support: https://nextjs.org/docs/api-routes/introduction - -export default (req, res) => { - res.statusCode = 200 - res.json({ name: 'John Doe' }) -} diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index 576c43e..489ff33 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -40,10 +40,6 @@ color-adjust:exact; } -.container tbody tr { - border-bottom: 1px solid rgb(206, 206, 206); -} - .container tbody tr td { padding: 2px 5px; } @@ -73,6 +69,10 @@ select.dropdown { padding: 20px 0; } +.summarytable tbody tr { + border-bottom: 1px solid rgb(206, 206, 206); +} + .bold { font-weight: 700; font-size: 17px; @@ -126,6 +126,10 @@ select.dropdown { width: 100%; } +.full-stats-table-body tr:nth-child(even) { + background: rgb(242, 242, 242); +} + .full-stats-heading { font-weight: 600; padding: 0 5px 0 10px; diff --git a/frontend/utils/utilities.js b/frontend/utils/utilities.js index 3ca896a..ee3cb63 100644 --- a/frontend/utils/utilities.js +++ b/frontend/utils/utilities.js @@ -51,9 +51,11 @@ export function formatTickPercent(d){ } -export function formatNumber(value){ - if(value < 1 && value !== 0){ +export function formatCellData(value, name){ + if(name === '% Households below 200% FPL' || name === '% of Households below 200% FPL Assisted'){ return Math.ceil(value * 100) + '%'; + } else if (name === 'Median Household Income') { + return `$${withComma(value)}` } else { return withComma(value); } From c6f8a2d2ca3d104ecdf0c158d1bbeb1cdacec649 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Tue, 30 Jun 2020 17:55:22 -0600 Subject: [PATCH 05/27] remove comment from config file --- frontend/next.config.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/frontend/next.config.js b/frontend/next.config.js index b2c348b..28e40ad 100644 --- a/frontend/next.config.js +++ b/frontend/next.config.js @@ -1,8 +1,5 @@ module.exports = { env: { - // API_ENDPOINT: process.env.NODE_ENV === ('production') - // ? process.env.NEXT_PUBLIC_API_ENDPOINT - // : 'http://127.0.0.1:8000/', API_ENDPOINT: 'https://energy-assistance-dashboard.herokuapp.com' }, } \ No newline at end of file From 882f58c1c5b8bfc59d922c55a821a03ca8376503 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Tue, 30 Jun 2020 18:04:33 -0600 Subject: [PATCH 06/27] change class to className in full stats component --- frontend/components/FullStats.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index 589a866..33ee7e2 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -14,7 +14,7 @@ const FullStats = (props) => { return (

Full Stats

-
{ topValue }{ cellData[0] }{ formatNumber(value ? value : 0) }{ formatCellData(val, cellData[0]) }
No Data for {selectedYear}No Data available
+
From 1d0b2ffd17b44b0c3b1c075466386dc3a13f5d1e Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Tue, 30 Jun 2020 19:10:56 -0600 Subject: [PATCH 07/27] remove config file fix another class -> classname issue --- frontend/components/FullStats.js | 20 ++++++++++---------- frontend/next.config.js | 5 ----- frontend/pages/index.js | 2 +- 3 files changed, 11 insertions(+), 16 deletions(-) delete mode 100644 frontend/next.config.js diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index 33ee7e2..579d101 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -26,19 +26,19 @@ const FullStats = (props) => { { selectedCountyData - ? ( + ? ( { tableData.map(item => { const cellData = Object.entries(item)[0]; return ( - - - { cellData[1].map(value => { - let val = value ? value : 0 - return ( - - ) - })} - + + + { cellData[1].map(value => { + let val = value ? value : 0 + return ( + + ) + })} + ) })} ) diff --git a/frontend/next.config.js b/frontend/next.config.js deleted file mode 100644 index 28e40ad..0000000 --- a/frontend/next.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - env: { - API_ENDPOINT: 'https://energy-assistance-dashboard.herokuapp.com' - }, - } \ No newline at end of file diff --git a/frontend/pages/index.js b/frontend/pages/index.js index a1af8db..0a1514b 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -7,7 +7,7 @@ import ParticipantsChart from '../components/ParticipantsChart'; import FullStats from '../components/FullStats'; import styles from '../styles/global.module.css' -const backendURL = process.env.API_ENDPOINT; +const backendURL = 'https://energy-assistance-dashboard.herokuapp.com'; class Index extends React.Component { constructor(props) { From fdeb5144772ddd258d1a7fcb9f3fc280b076adb2 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Wed, 1 Jul 2020 07:21:04 -0600 Subject: [PATCH 08/27] add key property for elms in map --- frontend/components/FullStats.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index 579d101..da635b2 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -18,24 +18,24 @@ const FullStats = (props) => { - { availableYears.map(year => { + { availableYears.map((year, i) => { return ( - + ) })} { selectedCountyData ? ( - { tableData.map(item => { + { tableData.map((item, i) => { const cellData = Object.entries(item)[0]; return ( - + - { cellData[1].map(value => { - let val = value ? value : 0 + { cellData[1].map((value, i) => { + const val = value ? value : 0; return ( - + ) })} From 7b14823a1ec2d0b9d804ec3ca04a0ddee5f5d5c5 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 17:55:01 -0600 Subject: [PATCH 09/27] fetch changes --- frontend/components/FullStats.js | 2 +- frontend/utils/utilities.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index da635b2..9e2c7a3 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -33,7 +33,7 @@ const FullStats = (props) => { { cellData[1].map((value, i) => { - const val = value ? value : 0; + const val = value ? value : '0'; return ( ) diff --git a/frontend/utils/utilities.js b/frontend/utils/utilities.js index ee3cb63..6bd7141 100644 --- a/frontend/utils/utilities.js +++ b/frontend/utils/utilities.js @@ -7,9 +7,9 @@ export function withComma(x) { export function formatPercent(barKey, value){ if(barKey == '% Households below 200% FPL') { - return Math.ceil(value * 100); + return Math.ceil(value * 100); } else { - return `${withComma(value)} `; + return withComma(value); } } From cb9c67bb15b5f6b69dc56bc868b709b3a2b1d409 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 19:06:55 -0600 Subject: [PATCH 10/27] add css to make everything fit one one page --- frontend/components/FullStats.js | 4 -- frontend/pages/index.js | 16 ++------ frontend/styles/global.module.css | 64 +++++++++++++++++++++++++++---- 3 files changed, 60 insertions(+), 24 deletions(-) diff --git a/frontend/components/FullStats.js b/frontend/components/FullStats.js index 1132afc..9e2c7a3 100644 --- a/frontend/components/FullStats.js +++ b/frontend/components/FullStats.js @@ -33,11 +33,7 @@ const FullStats = (props) => { { cellData[1].map((value, i) => { -<<<<<<< HEAD const val = value ? value : '0'; -======= - const val = value ? value : 0; ->>>>>>> upstream/master return ( ) diff --git a/frontend/pages/index.js b/frontend/pages/index.js index 3cf73d2..5e74853 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -74,11 +74,11 @@ function Index(props) { className={styles["eoc-logo"]} /> - {loading ? ( + { loading ? ( - ) : error ? ( -

The selected county could not be found, please try another.

- ) : ( + ) : error ? ( +

The selected county could not be found, please try another.

+ ) : (
@@ -116,7 +116,6 @@ function Index(props) { households served

2013 LEAP data is estimated due to lack of data

-

Data Last Updated: {selectedCountyUpdated}

)} @@ -168,12 +167,6 @@ function Index(props) { padding: 9px 10px; } -<<<<<<< HEAD -Index.getInitialProps = async function({ params }) { - //req to GET specific county data - const res = await fetch(`${backendURL}/counties/0`); - const data = await res.json(); -======= .rv-discrete-color-legend-item.horizontal { display: inline-block; } @@ -183,7 +176,6 @@ Index.getInitialProps = async function({ params }) { display: inline; padding-left: 10px; } ->>>>>>> upstream/master .rv-discrete-color-legend-item.vertical .rv-discrete-color-legend-item__title { diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index 489ff33..7b0c07a 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -16,7 +16,7 @@ } .eoc-logo { - height: 150px; + height: 140px; } .container h3 { @@ -139,12 +139,12 @@ select.dropdown { .full-stats-data { text-align: right; - font-size: 12px; + font-size: 10px; } .full-stats-row-heading { max-width: 180px; - font-size: 12px; + font-size: 10px; } @@ -163,13 +163,36 @@ select.dropdown { @media print { .container { box-shadow: none; + padding: 10px; + margin: 5px auto; + position: relative; } - .print-title { - font-size:18px; + + .container h3 { + font-size: 14px; + } + + .container table { + font-size: 10px; + } + + .container thead tr { + height: 16px; + } + + .eoc-logo { + height: 140px; + position: absolute; + top: 0; + right: 0; + } + + .bold { + font-size: 10px; } - .container h3{ - font-size:14px; + .summarytable { + padding: 0 0; } .historical-trends-charts { @@ -177,9 +200,34 @@ select.dropdown { width: fit-content; } - .no-print{ + .no-print, + .print-title { display: none !important; } + + .rv-discrete-color-legend-item { + padding: 5px 10px 0px; + } + + .global_chart__2UJn_ { + height: 1.8in; + padding: 6px 10px 6px; + } + + select.dropdown { + font-size: 10px; + padding: 6px; + } + + .sources h4 { + margin: 4px 0; + } + + .sources p { + font-size: 8px; + margin: 2px 0; + } + } From 60b5aa6b930e628390c4805d44278191c931db69 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 19:35:31 -0600 Subject: [PATCH 11/27] add styles for printing --- frontend/pages/index.js | 18 +++++++++++------- frontend/styles/global.module.css | 29 ++++++++++++++++++++++++----- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/frontend/pages/index.js b/frontend/pages/index.js index 5e74853..efb9634 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -17,6 +17,7 @@ function Index(props) { const countyQuery = router.query.county; const [selectedCountyData, setSelectedCountyData] = useState(null); + const [selectedCountyName, setSelectedCountyName] = useState(null); const [selectedCountyUpdated, setSelectedCountyUpdated] = useState(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); @@ -60,13 +61,16 @@ function Index(props) {

- Colorado Low Income Energy Stats + Colorado Low Income
Energy Stats

- +
+ Report for: + +
) : error ? ( -

The selected county could not be found, please try another.

+

The selected county could not be found, please try another.

) : (
diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index 7b0c07a..b43c83c 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -44,6 +44,10 @@ padding: 2px 5px; } +.print-label { + display: none; +} + .dropdown-container label { display: block; padding: 0 0 8px; @@ -168,6 +172,26 @@ select.dropdown { position: relative; } + .print-report { + display: flex; + } + + .print-label { + display: block; + font-size: 15px; + font-weight: 700; + text-transform: uppercase; + padding: 0; + margin-top: 1px; + } + + select.dropdown { + font-size: 15px; + padding: 0 0 20px 0; + border: none; + margin: 0 0 0 10px; + } + .container h3 { font-size: 14px; } @@ -214,11 +238,6 @@ select.dropdown { padding: 6px 10px 6px; } - select.dropdown { - font-size: 10px; - padding: 6px; - } - .sources h4 { margin: 4px 0; } From c4d6b2e9a4c184ee9f46c5ddb29a7a60fbd40444 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 19:36:32 -0600 Subject: [PATCH 12/27] remove name --- frontend/pages/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/pages/index.js b/frontend/pages/index.js index efb9634..e80a7b2 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -17,7 +17,6 @@ function Index(props) { const countyQuery = router.query.county; const [selectedCountyData, setSelectedCountyData] = useState(null); - const [selectedCountyName, setSelectedCountyName] = useState(null); const [selectedCountyUpdated, setSelectedCountyUpdated] = useState(null); const [error, setError] = useState(null); const [loading, setLoading] = useState(true); From 2611f79d09b0d69bef59f6823562fcf3dea5eabe Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 19:49:13 -0600 Subject: [PATCH 13/27] remove container padding --- frontend/styles/global.module.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index b43c83c..0fd1b9a 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -167,7 +167,7 @@ select.dropdown { @media print { .container { box-shadow: none; - padding: 10px; + padding: 0px; margin: 5px auto; position: relative; } From c0d273d4e5389d07fb8f9ad77ac8043207020e60 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 6 Jul 2020 19:53:55 -0600 Subject: [PATCH 14/27] edit error text styles --- frontend/pages/index.js | 2 +- frontend/styles/global.module.css | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/pages/index.js b/frontend/pages/index.js index e80a7b2..5f5201d 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -80,7 +80,7 @@ function Index(props) { { loading ? ( ) : error ? ( -

The selected county could not be found, please try another.

+

The selected county could not be found, please try another.

) : (
diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index 0fd1b9a..9ab765b 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -151,6 +151,12 @@ select.dropdown { font-size: 10px; } +h3.error-text { + text-transform: none; + font-weight: 500; + padding: 10px 0 0; +} + @media (max-width: 8.5in){ .historical-trends-charts { From 0af0633e6af88ef649c8199fe29edce477c19ffb Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Tue, 7 Jul 2020 17:45:46 -0600 Subject: [PATCH 15/27] add whitespace to top of graphs, add styles to charts and sources for improved look --- frontend/components/HouseholdsAssisted.js | 2 +- frontend/components/ParetoChart.js | 2 +- frontend/components/ParticipantsChart.js | 2 +- frontend/pages/index.js | 13 +++++++------ frontend/styles/global.module.css | 17 +++++++++++++---- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/frontend/components/HouseholdsAssisted.js b/frontend/components/HouseholdsAssisted.js index ae468de..397ac2b 100644 --- a/frontend/components/HouseholdsAssisted.js +++ b/frontend/components/HouseholdsAssisted.js @@ -40,7 +40,7 @@ class HouseholdsAssisted extends React.Component {
this.setState({hoveredNode: null})} > { hoveredNode && ( diff --git a/frontend/components/ParetoChart.js b/frontend/components/ParetoChart.js index 9ec34af..a8116c2 100644 --- a/frontend/components/ParetoChart.js +++ b/frontend/components/ParetoChart.js @@ -54,7 +54,7 @@ class ParetoChart extends React.Component {
this.setState({hoveredNode: null, type: null})} > diff --git a/frontend/components/ParticipantsChart.js b/frontend/components/ParticipantsChart.js index f33f511..cc8a8a5 100644 --- a/frontend/components/ParticipantsChart.js +++ b/frontend/components/ParticipantsChart.js @@ -53,7 +53,7 @@ class ParticipantsChart extends React.Component {
this.setState({hoveredNode: null})} > { hoveredNode && ( diff --git a/frontend/pages/index.js b/frontend/pages/index.js index d645b7e..f30ee21 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -71,8 +71,8 @@ function Index(props) { Colorado Low Income
Energy Stats -
- Report for: +
+ Report for:
); diff --git a/frontend/styles/global.module.css b/frontend/styles/global.module.css index 9ab765b..4feb6f8 100644 --- a/frontend/styles/global.module.css +++ b/frontend/styles/global.module.css @@ -99,9 +99,9 @@ select.dropdown { } .chart { - width:4in; - height:2in; - padding: 12px; + width: 3.98in; + height: 1.9in; + padding: 12px 12px 0; position: relative; } @@ -113,7 +113,7 @@ select.dropdown { box-shadow: 0 2px 4px rgba(0,0,0,0.5); color: #fff; white-space: nowrap; - top: 60px; + top: 10px; right: 20px; } @@ -157,6 +157,15 @@ h3.error-text { padding: 10px 0 0; } +.sources h4 { + font-size: 12px; + margin: 4px 0; +} + +.sources p { + font-size: 9px; + margin: 2px 0; +} @media (max-width: 8.5in){ .historical-trends-charts { From 0afad3035716ee52ecf6afcc912179eb1c23d185 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 20 Jul 2020 19:36:42 -0600 Subject: [PATCH 16/27] commit change --- frontend/components/ParetoChart.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/components/ParetoChart.js b/frontend/components/ParetoChart.js index a8116c2..c900d48 100644 --- a/frontend/components/ParetoChart.js +++ b/frontend/components/ParetoChart.js @@ -54,21 +54,21 @@ class ParetoChart extends React.Component {
this.setState({hoveredNode: null, type: null})} > {hoveredNode && ( d.x} - getY={d => d.y} - value={{ - Year: hoveredNode.x, - Value: (this.state.type == 'bar') - ? `${formatPercent(barKey, hoveredNode.y)}${barKey}` - : `${formatPercent(barKey, hoveredNode.y)}${lineKey}` - }} + className={styles.hint} + getX={d => d.x} + getY={d => d.y} + value={{ + Year: hoveredNode.x, + Value: (this.state.type == 'bar') + ? `${formatPercent(barKey, hoveredNode.y)}${barKey}` + : `${formatPercent(barKey, hoveredNode.y)}${lineKey}` + }} /> )} From 308ad87fe7861dc3bb8f81492806d7afa24fa83a Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Mon, 20 Jul 2020 19:59:42 -0600 Subject: [PATCH 17/27] add basic navbar styles --- frontend/components/Header.js | 3 - frontend/components/Nav.js | 25 +++-- frontend/package-lock.json | 5 + frontend/pages/about.js | 6 + frontend/pages/index.js | 196 +-------------------------------- frontend/styles/nav.module.css | 42 +++++++ 6 files changed, 74 insertions(+), 203 deletions(-) create mode 100644 frontend/styles/nav.module.css diff --git a/frontend/components/Header.js b/frontend/components/Header.js index 92b2a79..1490808 100644 --- a/frontend/components/Header.js +++ b/frontend/components/Header.js @@ -16,9 +16,6 @@ Router.onRouteChangeError = () => { const Header = () => ( ); diff --git a/frontend/components/Nav.js b/frontend/components/Nav.js index bf8f8bb..4a9e8c8 100644 --- a/frontend/components/Nav.js +++ b/frontend/components/Nav.js @@ -1,16 +1,25 @@ import Link from "next/link"; +import nav from "../styles/nav.module.css"; + // TODO: Add Navbar Styles const Nav = () => ( -
- - About - - - Counties - -
+ ); export default Nav; diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 64a3b4e..825b1cd 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -4696,6 +4696,11 @@ "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", "integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==" }, + "nprogress": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/nprogress/-/nprogress-0.2.0.tgz", + "integrity": "sha1-y480xTIT2JVyP8urkH6UIq28r7E=" + }, "nth-check": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-1.0.2.tgz", diff --git a/frontend/pages/about.js b/frontend/pages/about.js index 2d72580..3f186f1 100644 --- a/frontend/pages/about.js +++ b/frontend/pages/about.js @@ -4,6 +4,12 @@ function About(props) { return(
About Page +
) } diff --git a/frontend/pages/index.js b/frontend/pages/index.js index 3a71a19..2661c6f 100644 --- a/frontend/pages/index.js +++ b/frontend/pages/index.js @@ -1,203 +1,15 @@ // TODO: Create home page function Index(props) { -<<<<<<< HEAD - const { countyList } = props; - const countyQuery = props.query.county; - - const [selectedCountyData, setSelectedCountyData] = useState(null); - const [selectedCountyUpdated, setSelectedCountyUpdated] = useState(null); - const [error, setError] = useState(null); - const [loading, setLoading] = useState(true); - - //req to GET specific county data - const getCountyData = async (id) => { - const countyKey = getKeyByValue(countyList.counties, id); - id = countyKey ? countyKey : id; - - setLoading(true); - Router.push({ pathname: "/", query: { county: countyList.counties[id] } }); - const res = await fetch(`${backendURL}/counties/${id}`); - const data = await res.json(); - - if (res.ok) { - setSelectedCountyData(data.data); - setSelectedCountyUpdated(data.last_updated); - setError(null); - } else { - setError(res.status); - } - - setLoading(false); - }; - - const getCountyId = (e) => { - e.preventDefault(); - const id = e.target.value; - getCountyData(id); - }; - - useEffect(() => { - const { query } = props; - const countyQuery = query.county ? query.county : "COLORADO STATE" - getCountyData(countyQuery); - }, []); - - return ( -
- - Energy Assistance Dashboard - - - -
-
-
-

- Colorado Low Income
- Energy Stats -

-
- Report for: - -
-
- Energy Outreach Colorado Logo -
- { loading ? ( - - ) : error ? ( -

- The selected county could not be found, please try another. -

- ) : ( -
-
- - -
- -
-

Historical Trends

-
- - -
-
- - -
-
- -
-

Sources

-

- American Community Survey 5-Year Estimates by the Census Bureau, - Energy Outreach Colorado's households served, and CDHS LEAP - households served -

-

2013 LEAP data is estimated due to lack of data

-
-
- )} -
- + return( +
+ Home Page -======= - return( -
- Home Page ->>>>>>> upstream/master
) } diff --git a/frontend/styles/nav.module.css b/frontend/styles/nav.module.css new file mode 100644 index 0000000..6f152d2 --- /dev/null +++ b/frontend/styles/nav.module.css @@ -0,0 +1,42 @@ +.navbar { + font-family: 'Nunito', sans-serif; + display: flex; + justify-content: space-between; + padding: 20px 35px; + background: rgb(177, 177, 177); + box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.2); +} + +.nav-links { + width: 150px; + display: flex; + justify-content: space-between; +} + +.navbar a { + text-decoration: none; + color: black; + position: relative; +} + +.navbar a:hover { + /* color: rgb(186, 1, 1); */ +} + +.nav-links a::before { + content: ""; + position: absolute; + width: 100%; + height: 2px; + bottom: -4px; + left: 0; + background-color: black; + visibility: hidden; + transform: scaleX(0); + transition: all 0.3s ease-in-out 0s; +} + +.nav-links a:hover::before { + visibility: visible; + transform: scaleX(1); +} \ No newline at end of file From b0b8e35dd72d5c4655f2a51ad581c8a3ae434e77 Mon Sep 17 00:00:00 2001 From: Katie Hansen Date: Wed, 22 Jul 2020 18:26:53 -0600 Subject: [PATCH 18/27] add navigation styles --- frontend/components/Nav.js | 8 +++++++- frontend/pages/about.js | 5 +++-- frontend/pages/counties.js | 3 --- frontend/pages/index.js | 5 +++-- frontend/public/nprogress.css | 8 ++++---- frontend/styles/about.module.css | 12 ++++++++++++ frontend/styles/home.module.css | 10 ++++++++++ frontend/styles/nav.module.css | 24 ++++++++++++++++-------- 8 files changed, 55 insertions(+), 20 deletions(-) create mode 100644 frontend/styles/about.module.css create mode 100644 frontend/styles/home.module.css diff --git a/frontend/components/Nav.js b/frontend/components/Nav.js index 4a9e8c8..cfc447e 100644 --- a/frontend/components/Nav.js +++ b/frontend/components/Nav.js @@ -8,7 +8,13 @@ const Nav = () => (
{ cellData[0] }{ formatCellData(val, cellData[0]) }
{ cellData[0] }{ formatCellData(val, cellData[0]) }
{ year }{ year }
{ cellData[0] }{ formatCellData(val, cellData[0]) }{ formatCellData(val, cellData[0]) }
{ cellData[0] }{ formatCellData(val, cellData[0]) }
{ cellData[0] }{ formatCellData(val, cellData[0]) }
- - - - { availableYears.map((year, i) => { - return ( - - ) - })} - - - { selectedCountyData - ? ( - { tableData.map((item, i) => { - const cellData = Object.entries(item)[0]; - return ( - - - { cellData[1].map((value, i) => { - const val = value ? value : '0'; - return ( - - ) - })} - - ) - })} - ) - : ( +
+
{ year }
{ cellData[0] }{ formatCellData(val, cellData[0]) }
+ - + { availableYears.map((year, i) => { + return ( + + ) + })} - ) - } -
No Data available { year }
+ + { selectedCountyData + ? ( + { tableData.map((item, i) => { + const cellData = Object.entries(item)[0]; + return ( + + { cellData[0] } + { cellData[1].map((value, i) => { + const val = value ? value : '0'; + return ( + { formatCellData(val, cellData[0]) } + ) + })} + + ) + })} + ) + : ( + + No Data available + + + ) + } + +
) } diff --git a/frontend/pages/_app.js b/frontend/pages/_app.js index 64dca77..bc9d90a 100644 --- a/frontend/pages/_app.js +++ b/frontend/pages/_app.js @@ -5,9 +5,6 @@ function MyApp({ Component, pageProps }) {