Skip to content

Commit 947c0b5

Browse files
V48 (impl-only): Add Authorize GitHub chrome after wallet Connect
Show Authorize GitHub once the wallet is bound and GitHub App + ≥1 repository are incomplete; open Externals and purple-spotlight the Repository Connection card and install CTA.
1 parent e325bde commit 947c0b5

2 files changed

Lines changed: 39 additions & 7 deletions

File tree

uapi/components/auxillaries/AuxillariesSurface/AuxillariesSurface.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ export default function AuxillariesSurface({
7070
)}
7171

7272
{/*
73-
Wallet-native chrome: Connect focuses Wallet auxillary + connect CTAs;
74-
Disconnect when session or Bitcoin wallet is bound. No Connect
75-
chrome — identity entry is wallet binding.
73+
Wallet-native chrome:
74+
- Connect → Wallet pane + orange connect CTAs (identity entry)
75+
- Authorize GitHub → Externals pane + purple GitHub card/button
76+
(only after wallet bind, before App + ≥1 authorized repository)
77+
- Disconnect when session or Bitcoin wallet is bound
7678
*/}
7779
{surface.authLoaded && !surface.hasConnectedIdentity && (
7880
<button
@@ -87,6 +89,19 @@ export default function AuxillariesSurface({
8789
</button>
8890
)}
8991

92+
{surface.authLoaded && surface.needsGitHubConnectAttention && (
93+
<button
94+
type="button"
95+
data-auxillaries-testid="auxillaries-authorize-github-button"
96+
data-testid="auxillaries-authorize-github-button"
97+
onClick={surface.handleAuthorizeGitHubChrome}
98+
className="auxillaries-action-button auxillaries-authorize-github-button auxillaries-toggle-button orbital-toggle-button inline-flex h-10 min-w-[11.5rem] items-center justify-center rounded-none border border-fuchsia-300/40 bg-fuchsia-950/85 px-4 text-xs font-bold uppercase tracking-[0.12em] text-fuchsia-50 shadow-[0_14px_32px_rgba(0,0,0,0.24),0_0_0_1px_rgba(232,121,249,0.12)_inset] transition hover:-translate-y-px hover:border-fuchsia-200/55 hover:bg-fuchsia-900/90 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fuchsia-300/50"
99+
aria-label="Authorize GitHub"
100+
>
101+
Authorize GitHub
102+
</button>
103+
)}
104+
90105
{surface.authLoaded && surface.hasConnectedIdentity && (
91106
<button
92107
type="button"

uapi/components/auxillaries/AuxillariesSurface/hooks/use-auxillaries-surface.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,24 @@ export function useAuxillariesSurface({
5656
const { data: sessionUser, isLoading: userLoading } = useUser();
5757
const { data: profileData, isLoading: profileLoading } = useProfile();
5858
const { data: onboardingData } = useOnboarding();
59-
const { data: auxillaryData, hasWalletConnection, hasGitHubConnection, hasValidGitHubConnection } =
60-
useUserData();
59+
const {
60+
data: auxillaryData,
61+
hasWalletConnection,
62+
hasGitHubConnection,
63+
hasValidGitHubConnection,
64+
repositories,
65+
} = useUserData();
6166

6267
const authLoaded = !userLoading;
6368
// Wallet-native identity: a bound Bitcoin wallet counts as connected even
6469
// before a Supabase session user is present (Connect / Disconnect chrome).
6570
const hasConnectedIdentity = Boolean(sessionUser) || hasWalletConnection;
66-
const needsGitHubConnectAttention =
67-
hasWalletConnection && !(hasValidGitHubConnection || hasGitHubConnection);
71+
// Onboarding GitHub step: App install + at least one authorized repository.
72+
const hasAuthorizedGitHubRepository =
73+
(hasValidGitHubConnection || hasGitHubConnection) &&
74+
Array.isArray(repositories) &&
75+
repositories.length >= 1;
76+
const needsGitHubConnectAttention = hasWalletConnection && !hasAuthorizedGitHubRepository;
6877
const [supabaseClient] = useState(() => createClient());
6978
const router = useRouter();
7079
const pathname = usePathname();
@@ -327,13 +336,19 @@ export function useAuxillariesSurface({
327336
/**
328337
* After wallet is bound but GitHub is not: open Externals and purple-spotlight
329338
* the Repository Connection card + Install GitHub App button.
339+
* Used by auto-cue after wallet bind and by chrome "Authorize GitHub".
330340
*/
331341
const focusExternalsGitHubConnect = useCallback(() => {
332342
setCurrentStep('externals');
333343
trackEvent('auxillaries_connect_focus_github');
334344
requestGitHubConnectAttention();
335345
}, []);
336346

347+
/** Chrome twin of Connect: Externals pane + purple GitHub attention. */
348+
const handleAuthorizeGitHubChrome = useCallback(() => {
349+
focusExternalsGitHubConnect();
350+
}, [focusExternalsGitHubConnect]);
351+
337352
const prevWalletConnectedRef = useRef(false);
338353
const githubCueOnOpenRef = useRef(false);
339354

@@ -410,6 +425,7 @@ export function useAuxillariesSurface({
410425
sessionUser,
411426
hasWalletConnection,
412427
hasConnectedIdentity,
428+
needsGitHubConnectAttention,
413429
profileData,
414430
profileLoading,
415431
auxillaryData,
@@ -434,6 +450,7 @@ export function useAuxillariesSurface({
434450
auxillariesBackgroundAnimationClass,
435451
handleSignOut,
436452
handleConnectChrome,
453+
handleAuthorizeGitHubChrome,
437454
handleStepComplete,
438455
handleStepClick,
439456
handleStepCompletionChange,

0 commit comments

Comments
 (0)