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

🎉 (static charts) add portrait mode to Grapher's download options #2967

Merged
merged 15 commits into from
Jan 9, 2024

Conversation

sophiamersmann
Copy link
Member

@sophiamersmann sophiamersmann commented Nov 30, 2023

Adds portrait mode to Grapher's download options. Only available to download for authors, not for users.

  • Grapher currently exports charts at a fixed size (in landscape format)
  • This PR adds support for one more format (called “portrait” for now)
    • We might want to add more presets in the future (for example, for Instagram) but that’s tbd
  • The additional format should be available for download from the chart itself

This turned into a mild refactor of how the thumbnail worker calls Grapher and how Grapher internally handles font size:

  • Removes isGeneratingThumbnail – requiring an external caller to identify themselves is an anti-pattern
    • Thumbnail-specific behaviour only concerned the font size
    • The font size code has been refactored such that the isGeneratingThumbnail flag is unnecessary
  • Also fixes a thumbnail bug where details on the bottom overflowed (live / staging)

Other changes:

  • Adds a keyboard shortcut for toggling the download modal for convenience ("d")
  • Cleans up code around showAdminControls and code in the DownloadModal
  • Renames isExportingtoSvgOrPng to isExportingToSvgOrPng

Future work:

@sophiamersmann sophiamersmann marked this pull request as ready for review November 30, 2023 10:19
@@ -1681,26 +1693,40 @@ export class Grapher
return new Bounds(0, 0, DEFAULT_GRAPHER_WIDTH, DEFAULT_GRAPHER_HEIGHT)
}

@computed get portraitBounds(): Bounds {
return new Bounds(0, 0, DEFAULT_GRAPHER_HEIGHT, DEFAULT_GRAPHER_WIDTH)
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm doing a simple swap for now, but will look into what's a sensible default in subsequent PRs

Copy link
Member

@ikesau ikesau left a comment

Choose a reason for hiding this comment

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

Code looks good! tested on safari, chrome, and firefox.

@sophiamersmann sophiamersmann force-pushed the add-portrait-exports branch 2 times, most recently from e7e88e2 to 2842742 Compare December 15, 2023 17:31
Copy link

github-actions bot commented Jan 3, 2024

This PR has had no activity within the last two weeks. It is considered stale and will be closed in 3 days if no further activity is detected.

@sophiamersmann sophiamersmann changed the title Add portrait mode to Grapher's download options 🎉 (static charts) add portrait mode to Grapher's download options Jan 8, 2024
@sophiamersmann
Copy link
Member Author

sophiamersmann commented Jan 9, 2024

Merge activity

@sophiamersmann sophiamersmann merged commit 723e3ce into master Jan 9, 2024
22 of 23 checks passed
@sophiamersmann sophiamersmann deleted the add-portrait-exports branch January 9, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants