Skip to content

Commit 72ea08f

Browse files
authored
fix: improve login UX in dashboard - reload tray status, prevent cancel errors, and clarify login option naming (#931)
* retry tray. delete cancelpkce * rename * keep same
1 parent d0a8b85 commit 72ea08f

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

crates/fig_desktop_api/src/handler.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,11 @@ where
258258
AuthBuilderIdStartDeviceAuthorizationRequest(request) => {
259259
auth::builder_id_start_device_authorization(request, &ctx).await
260260
},
261-
AuthStartUnifiedPortalRequest(request) => auth::start_unified_portal(request).await,
261+
AuthStartUnifiedPortalRequest(request) => {
262+
let result = auth::start_unified_portal(request).await;
263+
event_handler.user_logged_in_callback(ctx).await;
264+
result
265+
},
262266
AuthBuilderIdPollCreateTokenRequest(request) => auth::builder_id_poll_create_token(request, &ctx).await,
263267
// codewhisperer api
264268
CodewhispererListCustomizationRequest(request) => codewhisperer::list_customization(request).await,

crates/q_cli/src/cli/user.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ enum AuthMethod {
131131
impl Display for AuthMethod {
132132
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
133133
match self {
134-
AuthMethod::BuilderId => write!(f, "Use for Free with Builder ID"),
134+
AuthMethod::BuilderId => write!(f, "Use with Builder ID"),
135135
AuthMethod::Social(SocialProvider::Google) => write!(f, "Use with Google"),
136136
AuthMethod::Social(SocialProvider::Github) => write!(f, "Use with GitHub"),
137-
AuthMethod::IdentityCenter => write!(f, "Use with Pro license"),
137+
AuthMethod::IdentityCenter => write!(f, "Use with IDC Account"),
138138
}
139139
}
140140
}

packages/dashboard-app/src/components/installs/modal/login/index.tsx

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export default function LoginModal({ next }: { next: () => void }) {
7272
setError(null);
7373
setLoginState("loading");
7474
const res = await Auth.startUnifiedPortal({});
75+
setPkceTimedOut(false);
76+
setAuthRequestId(undefined);
7577

7678
// Handle social login (Google/GitHub)
7779
if (res.kind === "social") {
@@ -90,9 +92,6 @@ export default function LoginModal({ next }: { next: () => void }) {
9092

9193
if (isSsoKind && res.issuerUrl && res.idcRegion) {
9294
// Start PKCE auth
93-
setPkceTimedOut(false);
94-
setAuthRequestId(undefined);
95-
9695
const init = await Auth.startPkceAuthorization({
9796
issuerUrl: res.issuerUrl,
9897
region: res.idcRegion,
@@ -295,7 +294,6 @@ export default function LoginModal({ next }: { next: () => void }) {
295294
setLoginMethod("deviceCode");
296295
setLoginState("not started");
297296
setError(null);
298-
Auth.cancelPkceAuthorization().catch(console.error);
299297
}}
300298
>
301299
Login with Device Code
@@ -322,7 +320,6 @@ export default function LoginModal({ next }: { next: () => void }) {
322320
setLoginMethod("deviceCode");
323321
setLoginState("not started");
324322
setError(null);
325-
Auth.cancelPkceAuthorization().catch(console.error);
326323
}}
327324
>
328325
Try authenticating with device code
@@ -336,6 +333,7 @@ export default function LoginModal({ next }: { next: () => void }) {
336333
onClick={() => {
337334
setLoginState("not started");
338335
setError(null);
336+
setAuthRequestId(undefined);
339337
Auth.cancelPkceAuthorization().catch(console.error);
340338
}}
341339
>
@@ -357,7 +355,13 @@ export default function LoginModal({ next }: { next: () => void }) {
357355
? () => setTab("iam")
358356
: () => setTab("builderId")
359357
}
360-
signInText={completedOnboarding ? "Log back in" : "Sign in"}
358+
signInText={
359+
completedOnboarding
360+
? tab === "builderId"
361+
? "Login with Builder ID"
362+
: "Login with IDC"
363+
: "Sign in"
364+
}
361365
/>
362366
<Button
363367
variant="ghost"
@@ -563,7 +567,13 @@ export default function LoginModal({ next }: { next: () => void }) {
563567
? () => setTab("iam")
564568
: () => setTab("builderId")
565569
}
566-
signInText={completedOnboarding ? "Log back in" : "Sign in"}
570+
signInText={
571+
completedOnboarding
572+
? tab === "builderId"
573+
? "Login with Builder ID"
574+
: "Login with IDC"
575+
: "Sign in"
576+
}
567577
/>
568578
)}
569579
</div>

packages/dashboard-app/src/components/installs/modal/login/tabs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function BuilderIdTab({
3939
variant={"ghost"}
4040
onClick={toggleTab}
4141
>
42-
<span className="text-xs">Use with Pro license</span>
42+
<span className="text-xs">Use with IDC Account</span>
4343
</Button>
4444
</div>
4545
);
@@ -232,7 +232,7 @@ function IamTab({
232232
variant={"ghost"}
233233
onClick={toggleTab}
234234
>
235-
<span className="text-xs">Use for Free with Builder ID</span>
235+
<span className="text-xs">Use with Builder ID</span>
236236
</Button>
237237
</div>
238238
</div>

0 commit comments

Comments
 (0)