-
Notifications
You must be signed in to change notification settings - Fork 0
Tonyvanswet/ele 1371 map UI basic geometries and colors #19
Tonyvanswet/ele 1371 map UI basic geometries and colors #19
Conversation
@@ -45,10 +51,15 @@ | |||
"@testing-library/react": "13.4.0", | |||
"@testing-library/user-event": "14.4.3", | |||
"@types/css-mediaquery": "0.1.1", | |||
"@types/d3-scale": "^4.0.2", | |||
"@types/geojson": "^7946.0.10", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope they don't follow semver otherwise they break things way to often. 😅
I'm unsure it's the best way to apply the colours but we now have a map to build from 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments - approving so you can merge when they are addressed :)
|
||
const mapZonesToGrid = ({ data, callerLocation }: GridState, getCo2colorScale: (co2intensity: number) => string) => { | ||
const keys = Object.keys(data.zones) as Array<keyof GridState>; | ||
const geographies = generateTopos(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's weird that we're doing this runtime, but we also do so in current app - is there any reason for that, @Kongkille? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. I actually also think generateTopos doesn't really do anything. We should probably be able to just import the topojson. I have not investigated. We could add a todo perhaps?
[theme] | ||
); | ||
|
||
const { isLoading, isError, error, data } = useGetState(TimeAverages.HOURLY, getCo2colorScale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
High-level comment: Should the map-related data manipulation live in the React Query hook? When we want to do the panel, tooltips, etc., we want to consume this too, but don't need the geometries, etc. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the panel will have it's own react query hook but I'm not sure on how the tool tip works. I thought the tooltip magically pulled the zonedata from the map ( const features = ref.current.queryRenderedFeatures(e.point);
), this might not be the best way though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it's fine to have multiple custom hooks related to the same tanstack-query.
For example the tooltip would not care about the entire state, so we could create a hook called 'useGetHoveredOverview' which returns a single overview.
For specificity we could call this hook useGetStateWithGeometries?
Co-authored-by: Mads Nedergaard <[email protected]>
Co-authored-by: Mads Nedergaard <[email protected]>
Co-authored-by: Mads Nedergaard <[email protected]>
Made a start on the map