1- import { AlertTriangle , RefreshCw } from "lucide-react" ;
1+ import { AlertTriangle , Info , RefreshCw } from "lucide-react" ;
22import * as React from "react" ;
33
44import { getNsec } from "@/shared/api/tauriIdentity" ;
55import { Button } from "@/shared/ui/button" ;
66import { Spinner } from "@/shared/ui/spinner" ;
7- import { StepProgress } from "@/shared/ui/step-progress" ;
87import {
98 type OnboardingTransitionDirection ,
109 OnboardingSlideTransition ,
@@ -14,51 +13,33 @@ import { NsecMaskedDisplay } from "./NsecMaskedDisplay";
1413/**
1514 * Pure helper so the disabled logic can be unit-tested without a DOM.
1615 *
17- * Disabled when:
18- * - still loading (key not fetched yet)
19- * - load failed (only the explicit "Skip for now" ghost advances past an error)
20- * - key loaded AND checkbox not yet checked
21- *
22- * Enabled when key is null after a clean (non-error) load — backend returned
23- * nothing, so there is nothing to acknowledge and the user may proceed.
16+ * Disabled while loading (key not fetched yet) or after a failed load (only
17+ * the explicit "Skip for now" ghost advances past an error).
2418 */
2519export function backupNextDisabled ( {
2620 isLoading,
2721 loadError,
28- nsec,
29- hasAcknowledged,
3022} : {
3123 isLoading : boolean ;
3224 loadError : string | null ;
33- nsec : string | null ;
34- hasAcknowledged : boolean ;
3525} ) : boolean {
36- return isLoading || loadError !== null || ( nsec !== null && ! hasAcknowledged ) ;
26+ return isLoading || loadError !== null ;
3727}
3828
3929type BackupStepProps = {
40- currentStep : number ;
4130 direction : OnboardingTransitionDirection ;
42- totalSteps : number ;
4331 onBack : ( ) => void ;
4432 onNext : ( ) => void ;
4533} ;
4634
4735/**
48- * Onboarding backup step — shows the user their nsec and requires
49- * acknowledgement before advancing . Only shown on the fresh-key path.
36+ * Onboarding backup step — shows the user their freshly created key so they
37+ * can save it somewhere safe . Only shown on the fresh-key path.
5038 */
51- export function BackupStep ( {
52- currentStep,
53- direction,
54- totalSteps,
55- onBack,
56- onNext,
57- } : BackupStepProps ) {
39+ export function BackupStep ( { direction, onBack, onNext } : BackupStepProps ) {
5840 const [ nsec , setNsec ] = React . useState < string | null > ( null ) ;
5941 const [ isLoading , setIsLoading ] = React . useState ( true ) ;
6042 const [ loadError , setLoadError ] = React . useState < string | null > ( null ) ;
61- const [ hasAcknowledged , setHasAcknowledged ] = React . useState ( false ) ;
6243 const cancelledRef = React . useRef ( false ) ;
6344
6445 const loadNsec = React . useCallback ( async ( ) => {
@@ -92,30 +73,29 @@ export function BackupStep({
9273
9374 return (
9475 < OnboardingSlideTransition
95- className = "flex w-full flex-col items-center pb-36 lg:pb-0 "
76+ className = "flex w-full flex-col items-center"
9677 data-testid = "onboarding-page-backup"
9778 direction = { direction }
9879 transitionKey = { `backup-${ direction } ` }
9980 >
10081 < div className = "w-full max-w-[500px] text-center" >
10182 < h1 className = "text-3xl font-semibold tracking-tight text-foreground" >
102- Save your private key
83+ Your unique identity has been created
10384 </ h1 >
104- < p className = "mt-3 text-sm leading-6 text-muted-foreground" >
105- Buzz generated a Nostr private key for you. This key is stored in your
106- system keychain, but you should also save it somewhere safe in case
107- you ever need to restore your account on another device.
85+ < p className = "mt-3 text-sm leading-6 text-foreground/80" >
86+ This key is stored in your system keychain, but save it some place
87+ safe in case you ever need to restore your account.
10888 </ p >
10989 </ div >
11090
111- < div className = "mt-8 w-full max-w-[500px] space-y-4 text-left " >
91+ < div className = "mt-10 w-full max-w-[640px] " >
11292 { isLoading ? (
113- < div className = "flex items-center gap-2 rounded-lg border border-border/70 bg-muted/30 px-4 py-6 text-sm text-muted- foreground" >
93+ < div className = "flex items-center justify-center gap-2 py-6 text-sm text-foreground/70 " >
11494 < Spinner className = "h-4 w-4 border-2" />
11595 Loading your private key…
11696 </ div >
11797 ) : loadError ? (
118- < div className = "space-y-3" >
98+ < div className = "mx-auto max-w-[500px] space-y-3 text-left " >
11999 < div
120100 className = "flex items-start gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-4 py-3 text-sm text-destructive"
121101 data-testid = "backup-load-error"
@@ -140,46 +120,31 @@ export function BackupStep({
140120 </ Button >
141121 </ div >
142122 ) : nsec ? (
143- < NsecMaskedDisplay nsec = { nsec } />
123+ < div className = "rounded-3xl bg-white/85 px-6 py-5 shadow-[0_0_70px_45px_rgba(255,255,255,0.85)]" >
124+ < NsecMaskedDisplay nsec = { nsec } variant = "bare" />
125+ </ div >
144126 ) : (
145- < p className = "text-sm text-muted- foreground" >
127+ < p className = "text-center text- sm text-foreground/70 " >
146128 No key available to back up.
147129 </ p >
148130 ) }
149131
150132 { nsec ? (
151- < div className = "rounded-lg border border-amber-500/30 bg-amber-500/10 px-4 py-3 text-sm leading-5 text-amber-700 dark:text-amber-400" >
152- < strong > Never share your private key.</ strong > Anyone with it can
153- impersonate you and access everything in your account.
154- </ div >
155- ) : null }
156-
157- { ! isLoading && ! loadError && nsec ? (
158- < label className = "flex cursor-pointer items-start gap-3" >
159- < input
160- checked = { hasAcknowledged }
161- className = "mt-0.5 h-4 w-4 shrink-0 cursor-pointer accent-primary"
162- data-testid = "backup-acknowledge"
163- onChange = { ( e ) => setHasAcknowledged ( e . target . checked ) }
164- type = "checkbox"
165- />
166- < span className = "text-sm leading-5" >
167- I've saved my private key in a safe place
133+ < p className = "mx-auto mt-6 flex max-w-[440px] items-start justify-center gap-1.5 text-center text-xs leading-5 text-foreground/70" >
134+ < Info className = "mt-0.5 h-3.5 w-3.5 shrink-0" />
135+ < span >
136+ Never share your private key. Anyone can impersonate you and
137+ access everything in your account.
168138 </ span >
169- </ label >
139+ </ p >
170140 ) : null }
171141 </ div >
172142
173- < div className = "mt-8 flex w-full max-w-[500px] flex-col gap-3 max-lg:pointer-events-none max-lg:fixed max-lg:inset-x-0 max-lg:bottom-0 max-lg:z-40 max-lg:mt-0 max-lg:max-w-none max-lg:border-t max-lg:border-border max-lg:bg-background max-lg:p-4 max-lg:pb-[max(1rem,env(safe-area-inset-bottom))] " >
143+ < div className = "mt-12 flex flex-col items-center gap-3 " >
174144 < Button
175- className = "h-10 w -full max-lg:pointer-events-auto "
145+ className = "h-10 rounded -full px-8 "
176146 data-testid = "onboarding-next"
177- disabled = { backupNextDisabled ( {
178- isLoading,
179- loadError,
180- nsec,
181- hasAcknowledged,
182- } ) }
147+ disabled = { backupNextDisabled ( { isLoading, loadError } ) }
183148 onClick = { onNext }
184149 type = "button"
185150 >
@@ -188,7 +153,7 @@ export function BackupStep({
188153
189154 { loadError ? (
190155 < Button
191- className = "h-10 w -full text-muted-foreground hover:text-accent-foreground max-lg:pointer-events-auto "
156+ className = "h-9 rounded -full px-5 text-muted-foreground hover:text-accent-foreground"
192157 data-testid = "backup-skip"
193158 onClick = { onNext }
194159 type = "button"
@@ -199,23 +164,14 @@ export function BackupStep({
199164 ) : null }
200165
201166 < Button
202- className = "h-10 w -full text-muted- foreground hover:text-accent-foreground max-lg:pointer-events-auto "
167+ className = "h-9 rounded -full bg- foreground/10 px-6 hover:bg-foreground/15 "
203168 data-testid = "onboarding-back"
204169 onClick = { onBack }
205170 type = "button"
206171 variant = "ghost"
207172 >
208173 Back
209174 </ Button >
210-
211- < StepProgress
212- activeSegmentClassName = "bg-primary"
213- className = "mt-1 max-lg:pointer-events-auto lg:hidden"
214- completeSegmentClassName = "bg-primary/35"
215- currentStep = { currentStep }
216- inactiveSegmentClassName = "bg-muted-foreground/25"
217- totalSteps = { totalSteps }
218- />
219175 </ div >
220176 </ OnboardingSlideTransition >
221177 ) ;
0 commit comments