-
Notifications
You must be signed in to change notification settings - Fork 937
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
fix(web): day ahead price styling features v3 #7274
fix(web): day ahead price styling features v3 #7274
Conversation
Quick feedback that @VIKTORVAV99 brought up 💡 Maybe we can ditch the |
Sounds good! I tried to play around with how we can avoid the space being so big when it is in languages that doesn't have AM/PM or similar, but I didn't find a good solution. Do you have an idea @VIKTORVAV99? |
I don't think the space is an issue but if we think it is I'd either pad it to center the time a bit more or give more space to the actual graph. But like I said I don't think it's an issue. |
Definitely not a blocker, but would be nice to have a more fluid layout when it comes to localising. |
Maybe we should leave it for now and then look at the more fluid layout later if we think it would be worth it. |
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 but looks like it's working!
useEffect(() => { | ||
const handleResize = () => { | ||
const divWidth = priceBarContainerReference?.current?.getBoundingClientRect().width; | ||
setPositiveWidth(calculateWidth(divWidth, negativePercentage, false)); | ||
setNegativeWidth(calculateWidth(divWidth, negativePercentage, true)); | ||
}; | ||
|
||
const observer = new ResizeObserver(handleResize); | ||
const current = priceBarContainerReference.current; | ||
|
||
if (current) { | ||
observer.observe(current); | ||
} | ||
|
||
return () => { | ||
if (current) { | ||
observer.unobserve(current); | ||
} | ||
}; | ||
}, [priceBarContainerReference, negativePercentage, isCollapsed]); |
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.
Do we really need a use effect?
It should only be used as a escape hatch if it can't fit in the normal rendering flow of react.
Wouldn't the useResizeObserver hook be a better option?
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 tried just using the useResizeObserver without the useEffect but I could not get it to work. If you have time and think it is important then it would be nice if you could try it. But you decide
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 can take a quick look but otherwise I don't consider this a blocking thing.
/review |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
@VIKTORVAV99, do you think I should try to refactor like GA-reviews says? |
No I don't think we need that, I would open a backlog issue about looking into using the resizeObserver hook though. But I don't think it's blocking. I'll give this a final review tomorrow but I don't anticipate any issues🙂 |
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.
LGTM! 🎉
I have one minor comment though, and I think we should look into the resize observer again at some point but none of them are blocking!
data-test-id="negative-price" | ||
> | ||
{price < 0 && ( | ||
<div> |
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 this div is needed?
This was what happened when I tried using the useResizeObserver, and I thought it was only when I switched to useResizeOberser, but apparently it does it now as well... To recreate open the futureprice and adjust the width of the browser. I will look into fixing this before we merge this PR |
I didn't notice that when using it normally (including resizing), but if you want to take another look at it don't let me stop you! |
I think I found a much simpler way of calculating the width that fixes all the problems (not using a useEffect and the resizing problem) @VIKTORVAV99 |
…ub.com/electricitymaps/electricitymaps-contrib into silkebonnen/avo-559-v3-day-ahead-price
Do you want to give it a final review or do you think its good to go now? |
I took a quick look at the last changes and I don't think it needs a new review, so just go ahead and merge it! |
Issue
AVO-559
Description
This PR highlights the top/bottom 5 percentage as green / red instead of just one value. It also shows 0 as a circle (12x*12 px) instead of nothing.
This is a follow up PR to #7272, so lets get that merged first.
Preview
Before:
After:
Double check
poetry run test_parser "zone_key"
pnpx prettier@2 --write .
andpoetry run format
in the top level directory to format my changes.