Skip to content

Add "PostHog Web" button to Bluebird top bar#2805

Merged
raquelmsmith merged 3 commits into
mainfrom
posthog-code/bluebird-posthog-web-button
Jun 20, 2026
Merged

Add "PostHog Web" button to Bluebird top bar#2805
raquelmsmith merged 3 commits into
mainfrom
posthog-code/bluebird-posthog-web-button

Conversation

@raquelmsmith

Copy link
Copy Markdown
Member

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 from cloudRegion, 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 lint on the changed file — clean.
  • Verified all imported symbols/paths resolve to existing exports.
  • Did not run the full app / typecheck (fresh clone without installed deps).

Automatic notifications

  • Publish to changelog?
  • Alert Sales and Marketing teams?

Created with PostHog Code

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

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

Comment on lines +113 to +117

// "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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 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
@raquelmsmith raquelmsmith marked this pull request as ready for review June 20, 2026 20:44
- 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
@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "Fix biome formatting and disable PostHog..." | Re-trigger Greptile

@raquelmsmith raquelmsmith merged commit 2b02a93 into main Jun 20, 2026
23 checks passed
@raquelmsmith raquelmsmith deleted the posthog-code/bluebird-posthog-web-button branch June 20, 2026 20:56
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