Skip to content

Commit a83c607

Browse files
fix(den): stabilize redirect loading layout (anomalyco#1719)
1 parent 2ae389a commit a83c607

2 files changed

Lines changed: 59 additions & 31 deletions

File tree

‎ee/apps/den-web/app/(den)/_components/auth-screen.tsx‎

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,37 @@ function FeatureCard({ title, body }: { title: string; body: string }) {
1818
);
1919
}
2020

21-
function LoadingPanel({ title, body }: { title: string; body: string }) {
21+
function SessionStatusPanel({ mode }: { mode: "checking" | "redirecting" }) {
22+
const status = mode === "checking"
23+
? {
24+
title: "Checking account",
25+
body: "If you are already signed in, we will open your workspace. Otherwise you can continue here.",
26+
}
27+
: {
28+
title: "Opening workspace",
29+
body: "You are signed in. We are taking you to the right Cloud destination.",
30+
};
31+
2232
return (
23-
<div className="den-frame grid gap-3 p-6 md:p-7">
33+
<div className="den-frame flex min-h-[420px] flex-col justify-between gap-8 p-6 md:p-7" role="status" aria-live="polite">
2434
<div className="grid gap-3">
25-
<p className="den-eyebrow">OpenWork Cloud</p>
26-
<h2 className="den-title-lg">{title}</h2>
27-
<p className="den-copy">{body}</p>
28-
</div>
29-
<div className="h-2 overflow-hidden rounded-full bg-[var(--dls-hover)]">
30-
<div className="h-full w-1/3 animate-pulse rounded-full bg-[var(--dls-accent)]" />
35+
<p className="den-eyebrow">Account</p>
36+
<div className="rounded-[1.5rem] border border-[var(--dls-border)] bg-[var(--dls-hover)]/60 p-4">
37+
<div className="flex items-start gap-3">
38+
<span className="relative mt-1 flex h-2.5 w-2.5 shrink-0">
39+
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-[var(--dls-accent)] opacity-30" />
40+
<span className="relative inline-flex h-2.5 w-2.5 rounded-full bg-[var(--dls-accent)]" />
41+
</span>
42+
<div className="min-w-0">
43+
<p className="m-0 text-[14px] font-medium text-[var(--dls-text-primary)]">{status.title}</p>
44+
<p className="mt-1 text-[13px] leading-6 text-[var(--dls-text-secondary)]">{status.body}</p>
45+
</div>
46+
</div>
47+
</div>
3148
</div>
49+
<p className="m-0 text-xs leading-5 text-[var(--dls-text-secondary)]">
50+
No action needed.
51+
</p>
3252
</div>
3353
);
3454
}
@@ -63,14 +83,6 @@ export function AuthScreen() {
6383
});
6484
}, [hasResolvedSession, pathname, resolveUserLandingRoute, router]);
6585

66-
if (!sessionHydrated) {
67-
return (
68-
<section className="den-page flex w-full items-center py-4 lg:min-h-[calc(100vh-2.5rem)]">
69-
<LoadingPanel title="Checking your session." body="Loading your Cloud account state..." />
70-
</section>
71-
);
72-
}
73-
7486
return (
7587
<section className="den-page flex w-full items-center py-4 lg:min-h-[calc(100vh-2.5rem)]">
7688
<div className="grid w-full gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(360px,440px)]">
@@ -138,11 +150,10 @@ export function AuthScreen() {
138150
</div>
139151

140152
<div className="order-1 lg:order-2">
141-
{hasResolvedSession ? (
142-
<LoadingPanel
143-
title="Redirecting to your workspace."
144-
body="We found your account and are sending you to the right Cloud destination now."
145-
/>
153+
{!sessionHydrated ? (
154+
<SessionStatusPanel mode="checking" />
155+
) : hasResolvedSession ? (
156+
<SessionStatusPanel mode="redirecting" />
146157
) : (
147158
<AuthPanel />
148159
)}

‎ee/apps/den-web/app/(den)/_components/checkout-screen.tsx‎

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,32 @@ function formatSubscriptionStatus(value: string | null | undefined) {
2020
.join(" ");
2121
}
2222

23-
function LoadingPanel({ title, body }: { title: string; body: string }) {
23+
function CheckoutStatusPanel({ body }: { body: string }) {
2424
return (
25-
<section className="den-page py-4">
26-
<div className="den-frame-soft grid max-w-[44rem] gap-4 p-6">
27-
<h1 className="text-xl font-semibold tracking-tight text-[var(--dls-text-primary)]">{title}</h1>
28-
<p className="text-sm text-[var(--dls-text-secondary)]">{body}</p>
25+
<section className="den-page grid gap-6 py-4 lg:py-6">
26+
<div className="den-frame grid gap-6 p-6 md:p-8 lg:p-10">
27+
<div className="flex flex-col gap-4 lg:max-w-3xl">
28+
<div className="grid gap-3">
29+
<p className="den-eyebrow">OpenWork Cloud</p>
30+
<h1 className="den-title-xl max-w-[14ch]">Shared workspace billing.</h1>
31+
<p className="den-copy max-w-2xl">
32+
Den is free for solo setup. Billing appears only when launching a shared cloud workspace.
33+
</p>
34+
</div>
35+
36+
<div className="rounded-[1.5rem] border border-[var(--dls-border)] bg-[var(--dls-hover)]/60 p-4" role="status" aria-live="polite">
37+
<div className="flex items-start gap-3">
38+
<span className="relative mt-1 flex h-2.5 w-2.5 shrink-0">
39+
<span className="absolute inline-flex h-full w-full animate-ping rounded-full bg-[var(--dls-accent)] opacity-30" />
40+
<span className="relative inline-flex h-2.5 w-2.5 rounded-full bg-[var(--dls-accent)]" />
41+
</span>
42+
<div className="min-w-0">
43+
<p className="m-0 text-[14px] font-medium text-[var(--dls-text-primary)]">Checking access</p>
44+
<p className="mt-1 text-[13px] leading-6 text-[var(--dls-text-secondary)]">{body}</p>
45+
</div>
46+
</div>
47+
</div>
48+
</div>
2949
</div>
3050
</section>
3151
);
@@ -170,15 +190,12 @@ export function CheckoutScreen({ customerSessionToken }: { customerSessionToken:
170190

171191
if (!sessionHydrated || (!user && !mockMode)) {
172192
return (
173-
<LoadingPanel
174-
title="Checking your billing session..."
175-
body="Loading your account and billing state before continuing."
176-
/>
193+
<CheckoutStatusPanel body="Checking whether you are signed in before showing workspace billing." />
177194
);
178195
}
179196

180197
if (redirectMessage) {
181-
return <LoadingPanel title="One moment." body={redirectMessage} />;
198+
return <CheckoutStatusPanel body={redirectMessage} />;
182199
}
183200

184201
const billingPrice = billingSummary?.price ?? null;

0 commit comments

Comments
 (0)