feat(canvas): add Leave feedback survey modal to Channels view#2792
Merged
Conversation
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
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
Contributor
Prompt To Fix All With AIFix 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 |
…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
Contributor
|
Reviews (2): Last reviewed commit: "style(canvas): wrap FeedbackModal JSX to..." | Re-trigger Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
/code. In the "Leave feedback" flow, submit/cancel just closes — no navigation.How it works
"survey sent"event, routed through the existingAnalyticsTrackerseam (newcaptureSurveyResponsemethod) so feature code never imports posthog-js directly.api-type single-open-question survey created + launched in PostHog. Its IDs are stored inpackages/ui/src/features/canvas/feedbackSurvey.ts:019ee235-2e3b-0000-64b3-5f2efa487452(us.posthog.com project 2)Files
features/canvas/components/FeedbackModal.tsx(new) — quillDialog+ RadixTextArea; 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.ts—captureSurveyResponseon the analytics tracker.router/routes/__root.tsx— buttons + modal wiring in the channels branch.apps/web/src/web-container.ts— no-opcaptureSurveyResponsefor the web stub tracker.The survey lives in us.posthog.com project 2, but the desktop app's analytics host is build-time configured (
VITE_POSTHOG_API_HOST, defaultinternal-c.posthog.com).survey sentevents only attach to this survey if the running build reports to project 2. Confirm viasurveys-responses-listonce a build pointed there exercises the flow.Test plan
@posthog/ui,@posthog/web,@posthog/codetypechecknoRestrictedImportsviolations)FeedbackModal.test.tsx(5 tests) + existingposthogAnalyticsImpltests (11) pass/website, both buttons render; "Leave feedback" shows Cancel and stays on Channels; "Go back to Code" shows Skip and routes to/codeon submit/skip🤖 Generated with Claude Code