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: Improve insights overall loading state #28229

Merged
merged 13 commits into from
Feb 12, 2025

Conversation

rafaeelaudibert
Copy link
Member

@rafaeelaudibert rafaeelaudibert commented Feb 3, 2025

Our loading state for insights isn't very modern and it occupies a lot of space. This was prompted by it not fitting the Web Vitals UI, let's tweak it all around the app and see if it looks nicer like this.

Gravacao.de.Tela.2025-02-05.153252.mp4

Does this work well for both Cloud and self-hosted?

Oh yeah

How did you test this code?

Visually locally + snapshots


Closes #28172

@rafaeelaudibert rafaeelaudibert requested review from corywatilo, adamleithp and a team February 3, 2025 18:52
@rafaeelaudibert
Copy link
Member Author

Marked as WIP while I fix CI - it'll certainly break

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Size Change: 0 B

Total Size: 1.18 MB

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

compressed-size-action

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 3822319 to 531668a Compare February 3, 2025 19:57
@PostHog PostHog deleted a comment from posthog-bot Feb 3, 2025
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 2dca437 to 822d62c Compare February 3, 2025 21:12
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 14 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.

@rafaeelaudibert rafaeelaudibert marked this pull request as ready for review February 3, 2025 22:15
@PostHog PostHog deleted a comment from posthog-bot Feb 3, 2025
Comment on lines 1 to 4
/* TODO: Migrate this to a CSS variable (with a `bg-` Tailwind class) once @adamleithp finishes his Tailwind work */
.insights-empty-state {
background-color: rgb(129 129 129 / 20%);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

@adamleithp I'm expecting us to be able to use some kind of ´bg-gray-600/50` class once your TW4 changes are live, are we getting that?

Copy link
Contributor

Choose a reason for hiding this comment

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

The idea is that we don't let engineers write this kind of tailwind class; adding opacity on the fly promotes deviation from controlled colors and leads to potential contrast issues!

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR modernizes the insight loading states across PostHog to be more visually lightweight and consistent with modern design patterns.

Key changes:

  • Replaced class-based selectors with data attributes (e.g. [data-attr="insight-empty-state"]) across test files for better maintainability
  • Added rotating loading messages with fade transitions in EmptyStates.tsx
  • Simplified loading state UI by removing extra wrappers and reducing vertical space
  • Implemented non-linear progress bar that caps at 99% using arctangent function
  • Consolidated styles using Tailwind classes instead of separate CSS files

The changes improve visual consistency while maintaining core functionality and test coverage.

13 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 43d1eb0 to 593b946 Compare February 4, 2025 16:40
Copy link
Member

@robbie-c robbie-c left a comment

Choose a reason for hiding this comment

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

I'll let the more design-oriented people give their feedback about that part. It looks like greptile has a few good comments here

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch 2 times, most recently from 7f3cb5d to fcfd04b Compare February 5, 2025 17:31
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 9414066 to 22949c3 Compare February 5, 2025 18:25
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 1 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.

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from fbf2245 to e45008d Compare February 7, 2025 14:29
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 0b5a030 to 1aa3e70 Compare February 7, 2025 22:09
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

  • chromium: 0 added, 3 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.

Copy link
Contributor

Choose a reason for hiding this comment

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

ah here it is, looks great

Copy link
Contributor

@adamleithp adamleithp left a comment

Choose a reason for hiding this comment

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

I think it could probably sit on the default background like before (less box inside a box, and also that progress bar remainder is kinda lost...), that's my only suggestion!

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it could probably sit on the default background like before (less box inside a box, and also that progress bar remainder is kinda lost...), that's my only suggestion!

Copy link
Member Author

Choose a reason for hiding this comment

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

The whole idea that @corywatilo suggested in #28172 is the box so that it looks more like a Skeleton with that gray background. The problem here might be that we're trying to add it to places it shouldn't be, thoughts? If the UI isn't ready for a Skeleton-ready container (too box-y, which I agree), then maybe we should just scratch this for now. Or maybe we should make that bg optional? Not sure

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah yea Cory does specifically [in a] "frame", ok fair enough, let's see how it goes! LGTM, it's definitely better than it was.

Comment on lines 1 to 4
/* TODO: Migrate this to a CSS variable (with a `bg-` Tailwind class) once @adamleithp finishes his Tailwind work */
.insights-empty-state {
background-color: rgb(129 129 129 / 20%);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The idea is that we don't let engineers write this kind of tailwind class; adding opacity on the fly promotes deviation from controlled colors and leads to potential contrast issues!

@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from 336aef1 to bc7309f Compare February 11, 2025 12:56
rafaeelaudibert and others added 10 commits February 12, 2025 10:03
This isn't very modern and it occupies a lot of space. This was prompted by it not fitting the Web Vitals UI, let's tweak it all around the app and see if it looks nicer like this.
Or else the snapshot is never generated because the selector is never found
We only need the gray background while loading, let's remove it from the other ones
@rafaeelaudibert rafaeelaudibert force-pushed the 28172-improve-insight-loading-state branch from bc7309f to abd6c9a Compare February 12, 2025 13:04
@rafaeelaudibert rafaeelaudibert enabled auto-merge (squash) February 12, 2025 13:05
@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

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

Triggered by this commit.

👉 Review this PR's diff of snapshots.

@rafaeelaudibert rafaeelaudibert merged commit d2809d0 into master Feb 12, 2025
103 checks passed
@rafaeelaudibert rafaeelaudibert deleted the 28172-improve-insight-loading-state branch February 12, 2025 13:52
zlwaterfield pushed a commit that referenced this pull request Feb 13, 2025
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
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.

~10x~ 2x the insight loading state
4 participants