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

✨ add 'square' option to grapher thumbnails #4448

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Jan 14, 2025

Adds an imType=square option to Grapher SVGs that returns a square version of the SVG with a white background (imType=social-media-square downloads a square version with beige background).

I need this for the Figma Plugin I'm working on.

I can verify that these changes work locally, but on staging imType=square returns the square image with beige background. Not sure why.

@github-actions github-actions bot added the staging-viz Let SVG tester fail silently in CI label Jan 14, 2025
@owidbot
Copy link
Contributor

owidbot commented Jan 14, 2025

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-grapher-thumbnail-square

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2025-01-14 12:27:05 UTC
Execution time: 1.19 seconds

@sophiamersmann sophiamersmann force-pushed the grapher-thumbnail-square branch from b4e84ea to 56b3639 Compare January 21, 2025 08:28
@sophiamersmann sophiamersmann marked this pull request as ready for review January 21, 2025 08:51
@marcelgerber
Copy link
Member

I can verify that these changes work locally, but on staging imType=square returns the square image with beige background. Not sure why.

Oh, nice find! That took a while to dig into, but it turns out that modifying squareOptions.grapherProps.isSocialMediaExport = true modified the constant SQUARE_OPTIONS (makes sense), and that modified state would then sometimes be used for subsequent requests while the worker was still "hot".

I just pushed a fix (and, turns out, I've made the same mistake a few lines below already!).

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! Fixed the issue you were running into, this is good to go now :)

@sophiamersmann
Copy link
Member Author

Nice! Thanks a lot :)

@sophiamersmann sophiamersmann merged commit 55ad01f into master Jan 21, 2025
19 of 21 checks passed
@sophiamersmann sophiamersmann deleted the grapher-thumbnail-square branch January 21, 2025 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
staging-viz Let SVG tester fail silently in CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants