Skip to content

Commit

Permalink
fix: top page logic
Browse files Browse the repository at this point in the history
  • Loading branch information
QuaidBartolomei committed Dec 16, 2021
1 parent d41f0c3 commit f0d64b9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/pages/top.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import * as utils from '../models/utils';
const useStyles = makeStyles()((theme) => ({
root: {
padding: theme.spacing(3, 4),
maxWidth: "100%",
boxSizing: "border-box",
maxWidth: '100%',
boxSizing: 'border-box',
},
title: {
fontFamily: 'Montserrat',
Expand All @@ -42,7 +42,7 @@ const useStyles = makeStyles()((theme) => ({

export default function Top({ trees, countries }) {
// use map context to get the map
const mapContext = useMapContext();
const { map } = useMapContext();

const { classes } = useStyles();

Expand All @@ -55,21 +55,21 @@ export default function Top({ trees, countries }) {

const { lat, lon } = country.centroid;

const { map } = mapContext;
map.flyTo(lat, lon, 6);
}

function handleFilter(filter) {
log.warn('handleFilter', filter);
mapContext.map.setFilters({
if (!map) return;
map.setFilters({
timeline: `${filter.startDate}_${filter.endDate}`,
});
mapContext.map.rerender();
map.rerender();
}

return (
<div className={classes.root}>
<Box sx={{display: "flex", justifyContent: "flex-end", }}>
<Box sx={{ display: 'flex', justifyContent: 'flex-end' }}>
<Filter onFilter={handleFilter} />
</Box>
<Typography variant="h2" className={classes.title}>
Expand Down

0 comments on commit f0d64b9

Please sign in to comment.