From 243d49894ed7b232e6411a2b1893bebf2fa4aea8 Mon Sep 17 00:00:00 2001 From: dadiorchen Date: Sat, 18 Dec 2021 11:30:54 +0800 Subject: [PATCH] fix: bugs in reporting card --- src/components/Home/Home.js | 9 ++++++--- src/components/reportingCards/ReportingCard4.js | 2 +- src/components/reportingCards/ReportingCard6.js | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Home/Home.js b/src/components/Home/Home.js index 03fb58928..4a595827e 100644 --- a/src/components/Home/Home.js +++ b/src/components/Home/Home.js @@ -29,6 +29,7 @@ import MenuItem from '@material-ui/core/MenuItem'; import MenuMui from '@material-ui/core/Menu'; import moment from 'moment'; import axios from 'axios'; +import log from 'loglevel'; /** * @function @@ -62,9 +63,9 @@ function Home(props) { }, []); const timeRange = [ { range: 30, text: 'Last Month' }, - { range: 30 * 60, text: 'Last 6 Months' }, - { range: 356, text: 'Last Year' }, - { range: 356 * 50, text: 'All' }, + { range: 30 * 6, text: 'Last 6 Months' }, + { range: 365, text: 'Last Year' }, + { range: 365 * 100, text: 'All' }, ]; const [timeRangeIndex, setTimeRangeIndex] = React.useState(3); const [startDate, setStartDate] = React.useState( @@ -80,7 +81,9 @@ function Home(props) { }; const handleTimeClose = (index) => { + log.warn("index: ", index); setAnchorEl(null); + if(isNaN(index)) return; setTimeRangeIndex(index); setStartDate( moment() diff --git a/src/components/reportingCards/ReportingCard4.js b/src/components/reportingCards/ReportingCard4.js index 6da0b6b64..78c5388a6 100644 --- a/src/components/reportingCards/ReportingCard4.js +++ b/src/components/reportingCards/ReportingCard4.js @@ -18,7 +18,7 @@ export default function component(props) { return (