Skip to content

Commit e84f3fe

Browse files
cynfrianpub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3
andauthored
feat(desktop): add fuzzy onboarding cards (#2141)
Signed-off-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co> Co-authored-by: npub19x6jnl6rhepymwyl2xlltz3ce7rfg2ktllle3g2vu59n3s490k8s9n40l3 <29b529ff43be424db89f51bff58a38cf86942acbffff98a14ce50b38c2a57d8f@sprout-oss.stage.blox.sqprod.co>
1 parent 1342fc5 commit e84f3fe

10 files changed

Lines changed: 204 additions & 152 deletions

File tree

‎desktop/src/features/communities/ui/WelcomeSetup.tsx‎

Lines changed: 118 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useCommunityOnboarding } from "@/features/onboarding/communityOnboardin
55
import { normalizeRelayUrl } from "@/features/communities/relayProbe";
66
import { InviteRedeemForm } from "@/features/onboarding/ui/InviteRedeemForm";
77
import {
8-
ONBOARDING_KEY_FRAME_CLASS,
98
ONBOARDING_KEY_ROW_CLASS,
109
ONBOARDING_KEY_TEXT_CLASS,
1110
} from "@/features/onboarding/ui/NsecMaskedDisplay";
@@ -20,10 +19,14 @@ import {
2019
import { getIdentity } from "@/shared/api/tauriIdentity";
2120
import { pubkeyToNpub } from "@/shared/lib/nostrUtils";
2221
import { Button } from "@/shared/ui/button";
22+
import { Card } from "@/shared/ui/card";
2323
import { Input } from "@/shared/ui/input";
2424
import { StartupWindowDragRegion } from "@/shared/ui/StartupWindowDragRegion";
2525
import { useSystemColorScheme } from "@/shared/theme/useSystemColorScheme";
26-
import { OnboardingChrome } from "@/features/onboarding/ui/OnboardingChrome";
26+
import {
27+
ONBOARDING_PRIMARY_CTA_CLASS,
28+
OnboardingChrome,
29+
} from "@/features/onboarding/ui/OnboardingChrome";
2730
import { HostedCommunityOnboarding } from "@/features/communities/ui/HostedCommunityOnboarding";
2831
import { writeTextToClipboard } from "@/shared/lib/clipboard";
2932

@@ -37,7 +40,16 @@ type WelcomeSetupProps = {
3740
};
3841

3942
const COMMUNITY_OPTION_CARD_CLASS =
40-
"flex min-h-24 w-full max-w-[352px] items-center justify-center rounded-xl bg-white/75 px-6 py-4 text-center text-sm font-normal leading-6 text-foreground transition-colors duration-150 ease-out hover:bg-white/85 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-foreground/35";
43+
"w-full max-w-[320px] items-center px-6 py-4 text-center text-sm font-normal leading-6 text-foreground [--buzz-card-textured-min-height:88px] transition-[filter] duration-150 ease-out hover:brightness-[0.98] focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-foreground/35";
44+
const WIDE_TEXTURE_CARD_CLASS =
45+
"relative left-1/2 w-[min(calc(100%+10rem),calc(100vw-2rem))] max-w-[1040px] -translate-x-1/2 px-8 py-6 [--buzz-card-textured-min-height:192px]";
46+
const WIDE_TEXTURE_CONTENT_CLASS = "mx-auto w-full max-w-[840px]";
47+
const HORIZONTAL_INPUT_OVERFLOW_FADE = {
48+
WebkitMaskImage:
49+
"linear-gradient(to right, transparent, black 2rem, black calc(100% - 2rem), transparent)",
50+
maskImage:
51+
"linear-gradient(to right, transparent, black 2rem, black calc(100% - 2rem), transparent)",
52+
};
4153

4254
export function WelcomeSetup({
4355
initialPage = "welcome",
@@ -111,16 +123,17 @@ export function WelcomeSetup({
111123

112124
return (
113125
<div
114-
className="buzz-onboarding-neutral-theme buzz-startup-shell flex min-h-dvh items-start justify-center overflow-y-auto bg-background px-4 pb-36 pt-[106px] text-foreground"
126+
className="buzz-onboarding-neutral-theme buzz-startup-shell flex h-dvh items-start justify-center overflow-y-auto bg-background px-4 pb-36 pt-[106px] text-foreground"
115127
data-system-color-scheme={systemColorScheme}
116128
>
117129
<StartupWindowDragRegion />
118130
<OnboardingChrome current={5} />
119131
<OnboardingFooterProvider>
120-
<div className="relative flex w-full max-w-4xl flex-col items-center text-center">
132+
<div className="relative flex min-h-0 w-full max-w-[920px] flex-1 flex-col items-center text-center">
121133
{page === "welcome" ? (
122134
<OnboardingSlideTransition
123-
className="flex w-full flex-col items-center text-center"
135+
className="flex h-full min-h-0 w-full flex-col items-center text-center"
136+
containerClassName="h-full min-h-0 [&>.buzz-onboarding-transition-line]:h-full"
124137
direction={transitionDirection}
125138
effect={welcomeEffect}
126139
transitionKey={`welcome-${welcomeEffect}-${transitionDirection}`}
@@ -134,30 +147,36 @@ export function WelcomeSetup({
134147
link, you can open it directly to continue setup.
135148
</p>
136149
</div>
137-
<div className="mt-28 flex w-full flex-col items-center gap-6">
138-
<button
150+
<div className="flex w-full flex-1 translate-y-16 flex-col items-center justify-center gap-20 py-8">
151+
<Card
152+
asChild
139153
className={COMMUNITY_OPTION_CARD_CLASS}
140-
onClick={() => showPage("join")}
141-
type="button"
154+
variant="textured"
142155
>
143-
Add me to a community
144-
</button>
145-
<button
156+
<button onClick={() => showPage("join")} type="button">
157+
Add me to a community
158+
</button>
159+
</Card>
160+
<Card
161+
asChild
146162
className={COMMUNITY_OPTION_CARD_CLASS}
147-
onClick={() => showPage("invite")}
148-
type="button"
163+
variant="textured"
149164
>
150-
I have an invite link
151-
</button>
152-
<button
165+
<button onClick={() => showPage("invite")} type="button">
166+
I have an invite link
167+
</button>
168+
</Card>
169+
<Card
170+
asChild
153171
className={COMMUNITY_OPTION_CARD_CLASS}
154-
onClick={() => showPage("owned")}
155-
type="button"
172+
variant="textured"
156173
>
157-
<span className="max-w-52">
158-
Create or connect to my own community
159-
</span>
160-
</button>
174+
<button onClick={() => showPage("owned")} type="button">
175+
<span className="max-w-52">
176+
Create or connect to my own community
177+
</span>
178+
</button>
179+
</Card>
161180
</div>
162181
<OnboardingFooter>
163182
<Button
@@ -192,58 +211,61 @@ export function WelcomeSetup({
192211
>
193212
Request access to a community
194213
</h1>
195-
<p className="mx-auto mt-3 max-w-[430px] text-sm leading-6">
196-
Ask the community host to send you an invite link or add you
197-
directly using your public key.
198-
</p>
199214
</div>
200-
<div className="flex w-full flex-1 items-center justify-center pb-2 pt-6">
201-
<div className="w-full max-w-4xl space-y-16">
202-
<section aria-labelledby="welcome-join-key-step">
215+
<div className="flex w-full flex-1 items-center justify-center">
216+
<div className="w-full max-w-[920px] space-y-16">
217+
<section
218+
aria-labelledby="welcome-join-key-step"
219+
className="translate-y-12"
220+
>
203221
<h2
204-
className="mb-4 text-sm font-normal"
222+
className="relative z-10 mb-8 text-sm font-normal"
205223
id="welcome-join-key-step"
206224
>
207-
Step 1: Share your public key
225+
Step 1: Ask your community host to send you an invite link
226+
or add you using your public key
208227
</h2>
209-
<div
210-
className={ONBOARDING_KEY_FRAME_CLASS}
228+
<Card
229+
className={WIDE_TEXTURE_CARD_CLASS}
211230
data-testid="welcome-join-npub-frame"
231+
variant="textured"
212232
>
213-
<div className={ONBOARDING_KEY_ROW_CLASS}>
214-
<div className="min-w-0 flex-1">
215-
<code
216-
className={`${ONBOARDING_KEY_TEXT_CLASS} block`}
217-
data-testid="welcome-join-npub"
233+
<div className={WIDE_TEXTURE_CONTENT_CLASS}>
234+
<div className={ONBOARDING_KEY_ROW_CLASS}>
235+
<div className="min-w-0 flex-1">
236+
<code
237+
className={`${ONBOARDING_KEY_TEXT_CLASS} block`}
238+
data-testid="welcome-join-npub"
239+
>
240+
{npub || "Loading…"}
241+
</code>
242+
</div>
243+
<Button
244+
aria-label="Copy npub"
245+
className="h-10 w-10 shrink-0 text-[var(--buzz-onboarding-backup-ink)] hover:bg-transparent hover:text-foreground"
246+
disabled={!npub}
247+
onClick={() => {
248+
void writeTextToClipboard(npub).then(() => {
249+
setCopied(true);
250+
window.setTimeout(() => setCopied(false), 1500);
251+
});
252+
}}
253+
size="icon"
254+
type="button"
255+
variant="ghost"
218256
>
219-
{npub || "Loading…"}
220-
</code>
257+
{copied ? (
258+
<Check
259+
className="h-6 w-6 text-primary"
260+
aria-hidden="true"
261+
/>
262+
) : (
263+
<Copy className="h-6 w-6" aria-hidden="true" />
264+
)}
265+
</Button>
221266
</div>
222-
<Button
223-
aria-label="Copy npub"
224-
className="h-10 w-10 shrink-0 text-[var(--buzz-onboarding-backup-ink)] hover:bg-transparent hover:text-foreground"
225-
disabled={!npub}
226-
onClick={() => {
227-
void writeTextToClipboard(npub).then(() => {
228-
setCopied(true);
229-
window.setTimeout(() => setCopied(false), 1500);
230-
});
231-
}}
232-
size="icon"
233-
type="button"
234-
variant="ghost"
235-
>
236-
{copied ? (
237-
<Check
238-
className="h-6 w-6 text-primary"
239-
aria-hidden="true"
240-
/>
241-
) : (
242-
<Copy className="h-6 w-6" aria-hidden="true" />
243-
)}
244-
</Button>
245267
</div>
246-
</div>
268+
</Card>
247269
{identityError ? (
248270
<p className="mt-4 text-sm text-destructive">
249271
{identityError}
@@ -257,27 +279,37 @@ export function WelcomeSetup({
257279
onSubmit={handleJoin}
258280
>
259281
<h2
260-
className="mb-4 text-sm font-normal"
282+
className="relative z-10 mb-8 text-sm font-normal"
261283
id="welcome-join-url-step"
262284
>
263285
Step 2: Paste in your community URL
264286
</h2>
265-
<Input
266-
aria-label="Community URL"
267-
autoCapitalize="none"
268-
autoCorrect="off"
269-
className="h-auto rounded-xl border-0 bg-white/50 px-8 py-7 text-center font-mono !text-4xl text-[color:var(--buzz-onboarding-backup-ink)] shadow-none placeholder:text-[color:var(--buzz-onboarding-backup-ink)] placeholder:opacity-10 focus-visible:ring-1 focus-visible:ring-[rgb(113_113_6_/_0.5)]"
270-
data-testid="welcome-join-community-url"
271-
id="welcome-join-community-url"
272-
onChange={(event) => {
273-
setRelayUrl(event.target.value);
274-
setRelayUrlError(null);
275-
}}
276-
placeholder="Enter community URL"
277-
spellCheck={false}
278-
type="url"
279-
value={relayUrl}
280-
/>
287+
<Card
288+
className={`${WIDE_TEXTURE_CARD_CLASS} [--buzz-card-textured-min-height:128px]`}
289+
variant="textured"
290+
>
291+
<div
292+
className={WIDE_TEXTURE_CONTENT_CLASS}
293+
style={HORIZONTAL_INPUT_OVERFLOW_FADE}
294+
>
295+
<Input
296+
aria-label="Community URL"
297+
autoCapitalize="none"
298+
autoCorrect="off"
299+
className="h-auto rounded-none border-0 bg-transparent p-0 text-center font-mono !text-4xl text-[color:var(--buzz-onboarding-backup-ink)] shadow-none placeholder:text-[color:var(--buzz-onboarding-backup-ink)] placeholder:opacity-10 focus-visible:ring-0"
300+
data-testid="welcome-join-community-url"
301+
id="welcome-join-community-url"
302+
onChange={(event) => {
303+
setRelayUrl(event.target.value);
304+
setRelayUrlError(null);
305+
}}
306+
placeholder="Enter community URL"
307+
spellCheck={false}
308+
type="url"
309+
value={relayUrl}
310+
/>
311+
</div>
312+
</Card>
281313
{relayUrlError ? (
282314
<p className="mt-3 text-sm text-destructive">
283315
{relayUrlError}
@@ -288,7 +320,7 @@ export function WelcomeSetup({
288320
</div>
289321
<OnboardingFooter>
290322
<Button
291-
className="h-10 w-44 rounded-full"
323+
className={ONBOARDING_PRIMARY_CTA_CLASS}
292324
disabled={!relayUrl.trim()}
293325
form="welcome-join-form"
294326
type="submit"
@@ -297,7 +329,7 @@ export function WelcomeSetup({
297329
<span className="sr-only">Join community</span>
298330
</Button>
299331
<Button
300-
className="h-10 w-44 rounded-full bg-foreground/10 hover:bg-foreground/15"
332+
className="h-9 rounded-full bg-foreground/10 px-6 hover:bg-foreground/15"
301333
onClick={() => showPage("welcome")}
302334
type="button"
303335
variant="ghost"
@@ -321,7 +353,7 @@ export function WelcomeSetup({
321353
continue setup.
322354
</p>
323355
</div>
324-
<div className="flex w-full flex-1 items-center justify-center pb-4 pt-12">
356+
<div className="flex w-full flex-1 items-center justify-center">
325357
<InviteRedeemForm
326358
error={null}
327359
isRedeeming={false}

‎desktop/src/features/onboarding/ui/BackupStep.tsx‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import * as React from "react";
33

44
import { getNsec } from "@/shared/api/tauriIdentity";
55
import { Button } from "@/shared/ui/button";
6+
import { Card } from "@/shared/ui/card";
67
import { Spinner } from "@/shared/ui/spinner";
78
import { ONBOARDING_PRIMARY_CTA_CLASS } from "./OnboardingChrome";
89
import { OnboardingFooter } from "./OnboardingFooter";
910
import {
1011
type OnboardingTransitionDirection,
1112
OnboardingSlideTransition,
1213
} from "./OnboardingSlideTransition";
13-
import {
14-
NsecMaskedDisplay,
15-
ONBOARDING_KEY_FRAME_CLASS,
16-
} from "./NsecMaskedDisplay";
14+
import { NsecMaskedDisplay } from "./NsecMaskedDisplay";
1715

1816
/**
1917
* Pure helper so the disabled logic can be unit-tested without a DOM.
@@ -78,12 +76,12 @@ export function BackupStep({ direction, onBack, onNext }: BackupStepProps) {
7876

7977
return (
8078
<OnboardingSlideTransition
81-
className="flex w-full flex-col items-center"
79+
className="flex min-h-0 w-full flex-col items-center"
8280
data-testid="onboarding-page-backup"
8381
direction={direction}
8482
transitionKey={`backup-${direction}`}
8583
>
86-
<div className="w-full max-w-[500px] text-center">
84+
<div className="flex w-full max-w-[500px] shrink-0 flex-col text-center">
8785
<h1 className="text-title font-normal text-foreground">
8886
Your unique identity key has been created
8987
</h1>
@@ -93,7 +91,7 @@ export function BackupStep({ direction, onBack, onNext }: BackupStepProps) {
9391
</p>
9492
</div>
9593

96-
<div className="mt-10 w-full max-w-4xl">
94+
<div className="flex w-full max-w-[1040px] flex-1 flex-col justify-center py-10">
9795
{isLoading ? (
9896
<div className="flex items-center justify-center gap-2 py-6 text-sm text-foreground/70">
9997
<Spinner className="h-4 w-4 border-2" />
@@ -125,10 +123,11 @@ export function BackupStep({ direction, onBack, onNext }: BackupStepProps) {
125123
</Button>
126124
</div>
127125
) : nsec ? (
128-
// Translucent white card frames the key with equal padding.
129-
<div className={ONBOARDING_KEY_FRAME_CLASS}>
130-
<NsecMaskedDisplay nsec={nsec} variant="bare" />
131-
</div>
126+
<Card className="w-full px-8 py-6" variant="textured">
127+
<div className="mx-auto w-full max-w-[832px]">
128+
<NsecMaskedDisplay nsec={nsec} variant="bare" />
129+
</div>
130+
</Card>
132131
) : (
133132
<p className="text-center text-sm text-foreground/70">
134133
No key available to back up.

0 commit comments

Comments
 (0)