Add "PostHog Web" button to Bluebird top bar#2805
Conversation
Adds a region-aware "PostHog Web" button with an external-link icon pinned to the far right of the Channels (project-bluebird) title bar. Clicking it opens the user's current project in the browser at https://<us|eu>.posthog.com/project/<id>, derived from cloudRegion, falling back to the account root when no project is set. Reuses existing utilities (getPostHogUrl, openUrlInBrowser, useAuthStateValue); no new helpers added. Generated-By: PostHog Code Task-Id: 146f5091-189a-4a5f-8456-0d9157ad48b1
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
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/router/routes/__root.tsx:113-117
**Silent no-op when `cloudRegion` is unset**
`getPostHogUrl` returns `null` when `cloudRegion` is `null` (see `urls.ts` line 11). If that happens, `handleOpenPostHogWeb` skips `openUrlInBrowser` with no feedback to the user — the button click silently does nothing. In practice this shouldn't happen for a signed-in user in the Channels space, but the failure mode is invisible. Consider either disabling the button when `getPostHogUrl(…)` would produce `null`, or at minimum logging a warning so the state is observable during development.
Reviews (1): Last reviewed commit: "Add "PostHog Web" button to Bluebird top..." | Re-trigger Greptile |
|
|
||
| // "PostHog Web" button in the Channels title bar: opens the user's current | ||
| // project on the correct cloud (region comes from cloudRegion via | ||
| // getPostHogUrl), falling back to the account root when no project is set. | ||
| const currentProjectId = useAuthStateValue((s) => s.currentProjectId); |
There was a problem hiding this comment.
Silent no-op when
cloudRegion is unset
getPostHogUrl returns null when cloudRegion is null (see urls.ts line 11). If that happens, handleOpenPostHogWeb skips openUrlInBrowser with no feedback to the user — the button click silently does nothing. In practice this shouldn't happen for a signed-in user in the Channels space, but the failure mode is invisible. Consider either disabling the button when getPostHogUrl(…) would produce null, or at minimum logging a warning so the state is observable during development.
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/ui/src/router/routes/__root.tsx
Line: 113-117
Comment:
**Silent no-op when `cloudRegion` is unset**
`getPostHogUrl` returns `null` when `cloudRegion` is `null` (see `urls.ts` line 11). If that happens, `handleOpenPostHogWeb` skips `openUrlInBrowser` with no feedback to the user — the button click silently does nothing. In practice this shouldn't happen for a signed-in user in the Channels space, but the failure mode is invisible. Consider either disabling the button when `getPostHogUrl(…)` would produce `null`, or at minimum logging a warning so the state is observable during development.
How can I resolve this? If you propose a fix, please make it concise.Clicking "PostHog Web" now opens the feedback modal first and navigates only once it's submitted or skipped, asking "Why are you going back to PostHog web?". The modal prompt is rendered at full contrast so the question is more visible in every mode. Also fires a "PostHog web opened" analytics event on click, and records where feedback came from (generic / going back to Code / visiting PostHog web) via a new single-choice survey question submitted alongside the open-text answer. Generated-By: PostHog Code Task-Id: 146f5091-189a-4a5f-8456-0d9157ad48b1
- Run biome format on FeedbackModal's MODAL_COPY to satisfy `biome ci`. - Disable the "PostHog Web" button when getPostHogUrl returns null (region unknown), so a click can never silently no-op. Addresses PR review feedback. Generated-By: PostHog Code Task-Id: 146f5091-189a-4a5f-8456-0d9157ad48b1
|
Reviews (2): Last reviewed commit: "Fix biome formatting and disable PostHog..." | Re-trigger Greptile |
Problem
In the Bluebird / Channels (Website) space (gated behind
project-bluebird), there's no quick way to jump from the desktop app back into the PostHog web app for the user's project.Why: Raquel wanted a one-click link from the Channels top bar out to PostHog web, landing on the right cloud (US vs EU) for the signed-in account.
Changes
Adds a region-aware "PostHog Web" button with an external-link icon, pinned to the far right of the Channels title bar (where "Leave feedback" lives). Clicking it opens
https://<us|eu>.posthog.com/project/<currentProjectId>in the browser — region derived fromcloudRegion, falling back to the account root if no project is selected.Reuses existing utilities (
getPostHogUrl,openUrlInBrowser,useAuthStateValue); no new helpers. Single file touched:packages/ui/src/router/routes/__root.tsx.How did you test this?
biome linton the changed file — clean.Automatic notifications
Created with PostHog Code