Skip to content

Commit

Permalink
fix: default time range; bug; layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dadiorchen committed Dec 18, 2021
1 parent 2855894 commit 970accb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
REACT_APP_WEBMAP_DOMAIN=http://dev.treetracker.org
REACT_APP_API_ROOT=https://dev-k8s.treetracker.org/api/admin
REACT_APP_TREETRACKER_API_ROOT=https://dev-k8s.treetracker.org/treetracker
REACT_APP_REPORTING_API_ROOT=https://dev-k8s.treetracker.org/reporting
REACT_APP_ENABLE_CAPTURE_MATCHING=true
REACT_APP_REPORTING_API_ROOT=https://dev-k8s.treetracker.org/reporting
REACT_APP_REPORTING_ENABLED=true
REACT_APP_ENABLE_EARNINGS=true
4 changes: 2 additions & 2 deletions src/components/Home/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function Home(props) {
React.useEffect(() => {
async function loadUpdateTime() {
const res = await axios(
`${process.env.REACT_APP_REPORTING_API_ROOT}/capture/statistics`,
`${process.env.REACT_APP_REPORTING_API_ROOT}/capture/statistics?`,
);
const { data } = res;
setUpdateTime(data.last_updated_at);
Expand All @@ -66,7 +66,7 @@ function Home(props) {
{ range: 356, text: 'Last Year' },
{ range: 356 * 50, text: 'All' },
];
const [timeRangeIndex, setTimeRangeIndex] = React.useState(0);
const [timeRangeIndex, setTimeRangeIndex] = React.useState(3);
const [startDate, setStartDate] = React.useState(
moment()
.add(-1 * timeRange[timeRangeIndex], 'day')
Expand Down
1 change: 1 addition & 0 deletions src/components/Home/Home.styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const styles = (theme) => ({
},
statCardGrid: {
padding: 0,
flexWrap: 'wrap',
},
});

Expand Down
2 changes: 2 additions & 0 deletions src/components/reportingCards/ReportingCard.hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export default function useLoadData(
url: `${process.env.REACT_APP_REPORTING_API_ROOT}/capture/statistics/card`,
params: {
card_title: field1,
capture_created_start_date: startDate ? startDate : undefined,
capture_created_end_date: endDate ? endDate : undefined,
// TODO optimize when data increases
limit: 100,
},
Expand Down

0 comments on commit 970accb

Please sign in to comment.