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

🔨 refactor hover states / TAS-738 #4266

Merged
merged 1 commit into from
Dec 13, 2024
Merged

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Dec 6, 2024

Refactor in preparation of adding focus state to line and slope charts.

Summary

  • Introduces InteractionState where active means 'actively focused/hovered' and background means 'another element is actively focused/hovered'
    • This could have been an enum as well (since no element can be active and in the background at the same time), but I like the ergonomics of the object better (typing hover.active is less verbose than hover === InteractionState.active)
  • Removes partitioning of series into focused and background series and instead renders an ordered series – once we add focus states to the mix, sorting becomes more practical
  • Renames 'focus' to 'hover' in line and slope charts wherever it's used

@sophiamersmann sophiamersmann changed the title 🔨 refactor hover states 🔨 refactor hover states / TAS-738 Dec 6, 2024
Copy link

Refactor hover states

@owidbot
Copy link
Contributor

owidbot commented Dec 6, 2024

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-refactor-hover-viz

SVG tester:

Number of differences (default views): 1420 (d948c2) ❌
Number of differences (all views): 615 (ffd8d6) ❌

Edited: 2024-12-13 13:46:05 UTC
Execution time: 1.29 seconds

@sophiamersmann sophiamersmann changed the base branch from admin-slope-viz to graphite-base/4266 December 11, 2024 13:01
@sophiamersmann sophiamersmann changed the base branch from graphite-base/4266 to master December 11, 2024 13:04
@sophiamersmann sophiamersmann force-pushed the refactor-hover-viz branch 3 times, most recently from a643f80 to a48699c Compare December 11, 2024 17:26
@sophiamersmann sophiamersmann force-pushed the refactor-hover-viz branch 4 times, most recently from 2250f24 to 7ef892f Compare December 12, 2024 10:51
@sophiamersmann sophiamersmann marked this pull request as ready for review December 12, 2024 10:53
Copy link
Member

@marcelgerber marcelgerber left a comment

Choose a reason for hiding this comment

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

nice refactoring!

Normally, I like to represent these things in such a way that it is impossible to represent invalid state (i.e., in this case {active: true, background: true}). but in this case, I can very much see the added benefit of using this syntax, so that's all good with me.

Copy link
Member Author

sophiamersmann commented Dec 13, 2024

Merge activity

  • Dec 13, 8:54 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Dec 13, 8:54 AM EST: A user merged this pull request with Graphite.

@sophiamersmann sophiamersmann merged commit 17ae4a9 into master Dec 13, 2024
21 checks passed
@sophiamersmann sophiamersmann deleted the refactor-hover-viz branch December 13, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants