Skip to content

feat: add show more buttons to page reports tiles #31143

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

Merged
merged 15 commits into from
Apr 15, 2025

Conversation

lricoy
Copy link
Member

@lricoy lricoy commented Apr 11, 2025

Important

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Problem

I've hidden those before because the modal-handling code we have was dedicated to the webAnalyticsLogic tiles, so it was not working outside of it given PageReports use a SectionTile separation instead of the TabTile.

Changes

  • Extracted the modal-related stuff to its own logic so it can handle both options.
  • Added the "Show more" buttons to Page Reports' tiles.

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

Yes

How did you test this code?

Manually

@posthog-bot
Copy link
Contributor

📸 UI snapshots have been updated

3 snapshot changes in total. 0 added, 3 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 5)
  • webkit: 0 added, 0 modified, 0 deleted

Triggered by this commit.

👉 Review this PR's diff of snapshots.

Copy link
Contributor

github-actions bot commented Apr 11, 2025

Size Change: -779 B (-0.01%)

Total Size: 13.6 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 13.6 MB -779 B (-0.01%)

compressed-size-action

@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.

@lricoy lricoy marked this pull request as ready for review April 11, 2025 18:58
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 extracts modal handling logic into a dedicated component to support both web analytics and page reports tiles, enabling "Show more" buttons across different tile types.

  • Created new webAnalyticsModalLogic.ts that serves as a bridge between webAnalyticsLogic and pageReportsLogic
  • Added new insightsUtils.ts with getDashboardItemId and getNewInsightUrlFactory functions
  • Modified WebAnalyticsModal.tsx to use the new modal logic instead of directly using webAnalyticsLogic
  • Added canOpenModal: true property to query tiles in pageReportsLogic.ts to enable modal functionality
  • Updated WebAnalyticsDashboard.tsx to use the new modal logic for consistent behavior across tile types

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

@lricoy lricoy force-pushed the feat/page-reports-add-show-more-modals branch from 2de679c to de228f3 Compare April 11, 2025 19:03
@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.

@lricoy lricoy enabled auto-merge (squash) April 11, 2025 19:18
@lricoy lricoy requested review from a team and jabahamondes and removed request for a team April 14, 2025 14:57
@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.

Copy link
Member

@rafaeelaudibert rafaeelaudibert left a comment

Choose a reason for hiding this comment

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

Code LGTM, left you a suggestion!

const { modal } = useValues(webAnalyticsModalLogic)

const { setDates } = useActions(webAnalyticsLogic)
const { closeModal } = useActions(webAnalyticsModalLogic)
Copy link
Member

Choose a reason for hiding this comment

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

To guarantee you're connecting to the right logic - and the inner logic is connecting to the right webAnalyticsLogic - you should add a BindLogic to WebAnalyticsDashboard. This guarantees all child components connect to the same instance of the logic.

This isn't a requirement because the logic is unique now (their path + props tuple is constant) but it might be a good thing to do this now to avoid bugs in the future

@lricoy lricoy merged commit f0bf225 into master Apr 15, 2025
95 of 109 checks passed
@lricoy lricoy deleted the feat/page-reports-add-show-more-modals branch April 15, 2025 21:44
@lricoy
Copy link
Member Author

lricoy commented Apr 15, 2025

Thanks @rafaeelaudibert! I just checked how the BindLogic works; I will add it later on to be safe about it

lricoy added a commit that referenced this pull request Apr 16, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants