-
Notifications
You must be signed in to change notification settings - Fork 1k
feat(web): add grid alerts to app #8281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
silkeholmebonnen
wants to merge
27
commits into
master
Choose a base branch
from
silkebonnen/gmm-870-only-show-grid-alert-on-the-map-if-it-is-currently-active
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(web): add grid alerts to app #8281
silkeholmebonnen
wants to merge
27
commits into
master
from
silkebonnen/gmm-870-only-show-grid-alert-on-the-map-if-it-is-currently-active
+347
−6
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
also run pnpx prettier@2 --write .
calculate centroid of polygon show alert icon in centroid for zones where there is an alert with "action" type create warning icon for the map
remove props not used in CurrentGridAlertsCard
format date to show on card implemented visual configuration of style according to alert type
The icon is only showed where there is Action alert in a zone. Warning icon's color depends on carbon intensity color of the zone on the map following the logic in CarbonIntensitySquare.
… of https://github.com/electricitymaps/electricitymaps-contrib into alejandranavarrocastil/gmm-838-visualize-alerts-on-map
…n-the-map-if-it-is-currently-active
2 tasks
…n-the-map-if-it-is-currently-active
Comment on lines
+107
to
+130
return ( | ||
<> | ||
{/* */} | ||
{warningIconData?.features.map((feature) => { | ||
const { zoneId } = feature.properties; | ||
const [longitude, latitude] = feature.geometry.coordinates; | ||
const zoneData = data?.datetimes[selectedDatetimeString]?.z[zoneId]; | ||
const intensity = zoneData ? getCarbonIntensity(zoneData, isConsumption) : 0; // Default to 0 if no data | ||
const bgColor = co2ColorScale(intensity); | ||
const iconColor = getTextColor(bgColor); | ||
|
||
return ( | ||
<Marker key={zoneId} longitude={longitude} latitude={latitude} anchor="center"> | ||
<div className="flex items-center justify-center rounded-full bg-white/10 p-2"> | ||
<FiAlertTriangle | ||
size={16} | ||
className={`-translate-y-px text-${iconColor}`} | ||
/> | ||
</div> | ||
</Marker> | ||
); | ||
})} | ||
</> | ||
); |
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.
Alejandra implemented this and I can see that it is different from the other map layers but it seems to work. From a little chat with AI it also seemed to be easier to use Marker when rendering Icons
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
GMM-870
Description
This PR builds on top of Alejandra's PR. It shows grid alerts on the map but only for on hourly or 5 minute view, and only the hours that it is active.
Preview
Double check
poetry run test_parser "zone_key"
pnpx prettier@2 --write .
andpoetry run format
in the top level directory to format my changes.