Good call — a dedicated route is cleaner than hijacking the layout. Here's a prompt:
Revise Phase 3: Replace inline GitHubSetupGate with a dedicated bind page
Currently the org layout at [slug]/layout.tsx renders <GitHubSetupGate> inline when no active binding exists. This replaces the entire org shell with a connect button, which feels like a UI hack rather than a proper flow.
Instead, create a dedicated page at /account/teams/new/bind (within the existing (user)/(pending-allowed) route group — same auth boundary as team creation). The flow becomes:
- Team creation:
team-name-form.tsx onSuccess → router.push(/account/teams/new/bind?slug=data.slug‘)‘(insteadofcurrent‘/{data.slug}`)
- Bind page:
/account/teams/new/bind?slug=acme-inc — shows "Connect your GitHub organization" UI with the connect button. On successful binding (BroadcastChannel github_connected + ), redirects to .
Changes from current implementation:
- Move
GitHubSetupGate content into a new page at apps/app/src/app/(app)/(user)/(pending-allowed)/account/teams/new/bind/page.tsx
- Read
slug from search params, validate org access, show connect UI
- On success,
router.push(/${slug}) — layout re-checks binding, renders normally
- Org layout: replace the
<GitHubSetupGate> render with redirect(/account/teams/new/bind?slug=${slug}) from next/navigation
- Delete
apps/app/src/app/(app)/(org)/[slug]/_components/github-setup-gate.tsx
- Update
team-name-form.tsx to redirect to /account/teams/new/bind?slug=${data.slug} instead of /${data.slug}
Keep everything else from the current implementation (binding check in layout, getGitHubBinding, tRPC router, BroadcastChannel error handling on the connected page, callback hardening, connection lifecycle sync).
Want me to implement this?