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

feat(experiments): add variant screenshots #25397

Merged
merged 12 commits into from
Oct 7, 2024

Conversation

jurajmajerik
Copy link
Contributor

@jurajmajerik jurajmajerik commented Oct 4, 2024

Changes

Users can now upload screenshots to visualize each variant in the Experiment UI.

Screen.Recording.2024-10-04.at.15.43.02.mov

How did you test this code?

👀

@jurajmajerik jurajmajerik requested a review from a team October 4, 2024 13:51
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Size Change: 0 B

Total Size: 1.13 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.13 MB

compressed-size-action

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

6 snapshot changes in total. 0 added, 6 modified, 0 deleted:

  • chromium: 0 added, 6 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 2)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik requested a review from Twixes October 7, 2024 08:18
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

4 snapshot changes in total. 0 added, 4 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

2 snapshot changes in total. 0 added, 2 modified, 0 deleted:

  • chromium: 0 added, 2 modified, 0 deleted (diff for shard 1)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@jurajmajerik jurajmajerik changed the title feat(experiments): add variant previews feat(experiments): add variant screenshots Oct 7, 2024
Comment on lines 50 to 54
<div className="relative">
<div className="Lettermark Lettermark--xlarge Lettermark--rounded Lettermark--variant-4">
<IconUpload />
</div>
</div>
Copy link
Member

@Twixes Twixes Oct 7, 2024

Choose a reason for hiding this comment

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

Plugging into the internals of another component is fragile – changes to Lettermark styling in the future are likely to break VariantPreviewImage. On a different note, there is very poor contrast between the upload icon and its background.

I propose a more conventional file input, which also lets us be more descriptive about this preview feature:

Suggested change
<div className="relative">
<div className="Lettermark Lettermark--xlarge Lettermark--rounded Lettermark--variant-4">
<IconUpload />
</div>
</div>
<>
<IconUpload className="text-2xl" />
<span>Upload a preview of this variant's UI</span>
</>

As a bonus, this empty state also uses the available space much more efficiently than the XXL pseudo-lettermark.

Looking like this:
Screenshot 2024-10-07 at 12 05 34

Comment on lines 60 to 61
<div className="text-muted inline-flex flow-row items-center gap-1 cursor-pointer">
<div onClick={() => setIsModalOpen(true)} className="cursor-pointer relative">
Copy link
Member

Choose a reason for hiding this comment

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

I had no idea that I must click on this tile to see the preview in a large scale – only realized this looking at the code! In other file upload contexts you click on the image to change it (e.g. org logo or Hog destinations). But an easy way to create the affordance for image expansion is cursor: zoom-in:

Screenshot 2024-10-07 at 12 21 55

<>
<div className="text-muted inline-flex flow-row items-center gap-1 cursor-pointer">
<div onClick={() => setIsModalOpen(true)} className="cursor-pointer relative">
<div className="relative flex overflow-hidden select-none size-16 rounded before:absolute before:inset-0 before:border before:rounded">
Copy link
Member

Choose a reason for hiding this comment

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

Screenshot 2024-10-07 at 12 10 15

This is so so small – when clearly we're not hard-pressed for space, looking at all the whitespace – that it's hard to see the point of the preview.

@jurajmajerik
Copy link
Contributor Author

Feedback addressed, thanks @Twixes!

2024-10-07 13 12 18

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

8 snapshot changes in total. 0 added, 8 modified, 0 deleted:

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Member

@Twixes Twixes left a comment

Choose a reason for hiding this comment

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

👌

@jurajmajerik jurajmajerik enabled auto-merge (squash) October 7, 2024 13:58
@jurajmajerik jurajmajerik merged commit fb92840 into master Oct 7, 2024
93 checks passed
@jurajmajerik jurajmajerik deleted the experiment-variant-preview branch October 7, 2024 15:04
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