Skip to content
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 6203 tooltip overflows behind screen #6359

Conversation

PmplCode
Copy link
Contributor

@PmplCode PmplCode commented Jan 17, 2024

Issue

Closes #6203 , although it is my first time taking part on an open source project and i would like guidance.

Description

tooltip remains visible everytime even with scrolled screen.

Preview

https://www.linkedin.com/posts/eloipampliegajose_opensource-frontenddev-electricitymaps-activity-7153079821013508096-yzqW

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier --write . and poetry run format to format my changes.

…reakdownChart.tsx i've managed to, on desktop, get height of header and place a limit to position y of the tooltip so it can not go further. further. On AreaGraphTooltip the same solution does not work so i placed a fixed value on desktop.
…phTooltip also fixed, now working as the BarBreakdownChart toolkit.
Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great for the changed tooltips!

However this also affects the exchange tooltips as well so would be good if we could change those too.

I also left some suggestions that could simplify the code.

web/src/features/charts/elements/AreaGraph.tsx Outdated Show resolved Hide resolved
@madsnedergaard
Copy link
Member

Hey @PmplCode, let us know if you need any help with implementing the suggestions :)

@PmplCode
Copy link
Contributor Author

Hey, @madsnedergaard @VIKTORVAV99 thanks for the suggestions! During this week I'll try to implement this solution.

On the exchange tooltips I haven't seen any style for the position. I'll to figure out how to apply the conditions.

Thanks and we stay in touch!

@PmplCode
Copy link
Contributor Author

Hello, @madsnedergaard @VIKTORVAV99 . Sorry for taking some more time to solve this problem. Today I woke up inspired and I think i got the fix for the exchange tooltips.

If you want to check it out and maybe discuss a better solution or approach for this.

Thanks and stay in touch!

@VIKTORVAV99 VIKTORVAV99 self-requested a review February 24, 2024 20:43
@PmplCode
Copy link
Contributor Author

PmplCode commented Apr 2, 2024

Hello! How is it going?
Is there anything I forgot to do or anything in general?
Thanks!

@VIKTORVAV99
Copy link
Member

We have just been a bit busy and unable to prioritize this just yet.

I had hoped to get around to it this weekend that was but other things such as parser changes came up instead (which has a higher priority as it affects all our data).

Hopefully I'll be able to take another look at it soon though.

Copy link
Member

@VIKTORVAV99 VIKTORVAV99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some final notes, but it looks very good!

web/src/features/charts/bar-breakdown/utils.ts Outdated Show resolved Hide resolved
web/src/features/exchanges/ExchangeArrow.tsx Outdated Show resolved Hide resolved
@PmplCode
Copy link
Contributor Author

PmplCode commented Apr 8, 2024

Hey @VIKTORVAV99 ,
thanks for your notes, very accurate!
I've fixed the getHeaderHeight util and refactor the tooltipClassName.

@VIKTORVAV99 VIKTORVAV99 self-requested a review April 8, 2024 18:31
@VIKTORVAV99
Copy link
Member

Hey @VIKTORVAV99 , thanks for your notes, very accurate! I've fixed the getHeaderHeight util and refactor the tooltipClassName.

Thanks! I'll take a look as soon as possible!

@madsnedergaard
Copy link
Member

For a future version (not now) we could consider using https://floating-ui.com/ to handle placement of tooltips, it seems pretty nice and powerful :)

@PmplCode
Copy link
Contributor Author

PmplCode commented Apr 9, 2024

Looks good, although I have never used floating-ui it seems pretty easy, at least looking at its documentation.
I'd love to take part of this change.

Copy link
Member

@madsnedergaard madsnedergaard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey again, sorry it took so long to get this reviewed again - to avoid wasting your time I've gone ahead and ensured this PR is up-to-date with master (and fixed a small thing with hooks by renaming getHeaderHeight to useHeaderHeight) :)

I have tested it locally and it works great, thanks for taking the time to make this change - I promise the turnaround time is usually significantly faster 😅

@madsnedergaard madsnedergaard merged commit 6aa0ecc into electricitymaps:master May 22, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tooltip overflows behind the top of the screen
3 participants