Skip to content

feat(canvas): add Leave feedback survey modal to Channels view#2792

Merged
raquelmsmith merged 4 commits into
mainfrom
posthog-code/channels-leave-feedback-modal
Jun 20, 2026
Merged

feat(canvas): add Leave feedback survey modal to Channels view#2792
raquelmsmith merged 4 commits into
mainfrom
posthog-code/channels-leave-feedback-modal

Conversation

@raquelmsmith

Copy link
Copy Markdown
Member

Summary

Adds a "Leave feedback" button next to "Go back to Code" in the project-bluebird Channels title bar, and routes "Go back to Code" through the same modal first.

  1. Leave feedback → opens a modal with a text box; submitting records the text as a PostHog survey response.
  2. Go back to Code → opens the same modal as a gentle intercept. The user can Skip (the secondary button reads "Skip" only in this flow; it reads "Cancel" when opened via "Leave feedback"). After submit or skip, the user is routed back to /code. In the "Leave feedback" flow, submit/cancel just closes — no navigation.

How it works

  • Survey responses are sent via posthog-js's "survey sent" event, routed through the existing AnalyticsTracker seam (new captureSurveyResponse method) so feature code never imports posthog-js directly.
  • The backing survey is an api-type single-open-question survey created + launched in PostHog. Its IDs are stored in packages/ui/src/features/canvas/feedbackSurvey.ts:

Files

  • features/canvas/components/FeedbackModal.tsx (new) — quill Dialog + Radix TextArea; Skip/Cancel labeling driven by mode; submit disabled until text entered.
  • features/canvas/feedbackSurvey.ts (new) — survey/question ID constants.
  • shell/analytics.ts + shell/posthogAnalyticsImpl.tscaptureSurveyResponse on the analytics tracker.
  • router/routes/__root.tsx — buttons + modal wiring in the channels branch.
  • apps/web/src/web-container.ts — no-op captureSurveyResponse for the web stub tracker.

⚠️ Note on the survey project

The survey lives in us.posthog.com project 2, but the desktop app's analytics host is build-time configured (VITE_POSTHOG_API_HOST, default internal-c.posthog.com). survey sent events only attach to this survey if the running build reports to project 2. Confirm via surveys-responses-list once a build pointed there exercises the flow.

Test plan

  • @posthog/ui, @posthog/web, @posthog/code typecheck
  • Biome lint clean on all touched files (no noRestrictedImports violations)
  • New FeedbackModal.test.tsx (5 tests) + existing posthogAnalyticsImpl tests (11) pass
  • Manual: in /website, both buttons render; "Leave feedback" shows Cancel and stays on Channels; "Go back to Code" shows Skip and routes to /code on submit/skip

🤖 Generated with Claude Code

Adds a "Leave feedback" button next to "Go back to Code" in the project-bluebird
Channels title bar. Clicking it opens a modal with a text box that records the
input as a PostHog survey response.

"Go back to Code" now opens the same modal first as a gentle intercept. The
secondary button reads "Skip" when opened that way and "Cancel" when opened via
"Leave feedback". After submit or skip in the leaving flow, the user is routed
back to /code; in the feedback flow submit/cancel just closes.

Survey responses are sent via posthog-js's "survey sent" event through the
existing AnalyticsTracker seam (new captureSurveyResponse method), so feature
code never imports posthog-js directly. The backing survey is an api-type
single-open-question survey created in PostHog (id + question id stored in
feedbackSurvey.ts).

Generated-By: PostHog Code
Task-Id: d326ecd6-fe74-4c86-8c15-6f028888ebc2
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 69da6e9.

@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
packages/ui/src/features/canvas/components/FeedbackModal.test.tsx:27-45
**Two similar mode/button-label tests could be parameterised**

The two tests that verify which secondary button label appears are structurally identical and differ only in their `mode`, `expectedButton`, and `missingButton` values. The team's convention is to prefer parameterised tests. Merging them into a single `it.each` would remove the duplication without losing any coverage.

Reviews (1): Last reviewed commit: "feat(canvas): add Leave feedback survey ..." | Re-trigger Greptile

Comment thread packages/ui/src/features/canvas/components/FeedbackModal.test.tsx
…test

Address review feedback on the Channels feedback modal:

- Wrap the textarea in DialogBody so it gets the quill dialog's inline padding
  instead of spanning the modal edge-to-edge.
- Move the textarea state into a child component mounted only while the modal is
  open, so it resets on each open without syncing state to the `mode` prop in an
  effect (fixes React Doctor no-adjust-state-on-prop-change).
- Parameterise the two secondary-button-label tests into a single it.each, per
  the repo's parameterised-test convention (Greptile).

Generated-By: PostHog Code
Task-Id: d326ecd6-fe74-4c86-8c15-6f028888ebc2
Replace the unstyled Radix TextArea with quill's Textarea design-system
component, which has proper internal padding, border, and background.

Generated-By: PostHog Code
Task-Id: d326ecd6-fe74-4c86-8c15-6f028888ebc2
Generated-By: PostHog Code
Task-Id: d326ecd6-fe74-4c86-8c15-6f028888ebc2
@raquelmsmith raquelmsmith marked this pull request as ready for review June 20, 2026 00:32
@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "style(canvas): wrap FeedbackModal JSX to..." | Re-trigger Greptile

@raquelmsmith raquelmsmith merged commit 3229803 into main Jun 20, 2026
26 of 27 checks passed
@raquelmsmith raquelmsmith deleted the posthog-code/channels-leave-feedback-modal branch June 20, 2026 00:41
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.

1 participant