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: add more details to NPS score [part 2] #29112

Merged
merged 11 commits into from
Feb 25, 2025

Conversation

lucasheriques
Copy link
Contributor

Problem

currently, our NPS score view is limited, because while it shows the score, it doesn't show the % of detractors, passive or promoters.

Changes

before:

CleanShot 2025-02-23 at 02 23 43@2x

after:

CleanShot 2025-02-23 at 02 24 03@2x

adds a new StackBar reusable component, now used for both NPS Breakdown and Survey Stats.

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

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

yes

How did you test this code?

unit tests on the previews PR

@lucasheriques lucasheriques requested a review from a team February 23, 2025 05:25
@lucasheriques lucasheriques self-assigned this Feb 23, 2025
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 enhances the NPS (Net Promoter Score) visualization in survey results by adding a detailed breakdown view.

  • Added new reusable StackedBar component in /frontend/src/scenes/surveys/surveyViewViz.tsx for consistent bar chart visualization
  • Implemented NPSStackedBar component to display percentage breakdown of promoters, passives, and detractors
  • Added tooltip in survey view explaining NPS score calculation methodology
  • Refactored UsersStackedBar to leverage the new StackedBar component for consistency
  • Enhanced survey results view with color-coded segments showing relative proportions of each NPS category

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

{/* eslint-disable-next-line react/forbid-dom-props */}
<div className="w-3 h-3 rounded-full mr-2" style={style} />
<div key={`stacked-bar-legend-${label}`} className="flex items-center mr-6">
{}
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Empty JSX fragment {} can be removed

Suggested change
{}

@lucasheriques lucasheriques force-pushed the feat/add-more-details-to-nps-score-part-2 branch from 4ec9698 to 8ba698a Compare February 23, 2025 05:28
Copy link
Contributor

github-actions bot commented Feb 23, 2025

Size Change: 0 B

Total Size: 9.72 MB

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

compressed-size-action

@marandaneto
Copy link
Member

Nice, cool stuff.

Base automatically changed from feat/add-more-details-to-nps-score to master February 25, 2025 14:25
@lucasheriques lucasheriques merged commit 5f918f5 into master Feb 25, 2025
97 checks passed
@lucasheriques lucasheriques deleted the feat/add-more-details-to-nps-score-part-2 branch February 25, 2025 20:01
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.

2 participants