Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export function MachineOnboardingFlow({
const [error, setError] = React.useState<string | null>(null);
const [isPending, setIsPending] = React.useState(false);
const [identityWasImported, setIdentityWasImported] = React.useState(false);
const [importedNsec, setImportedNsec] = React.useState("");
const [selectedPubkey, setSelectedPubkey] = React.useState<string | null>(
null,
);
Expand Down Expand Up @@ -103,6 +104,7 @@ export function MachineOnboardingFlow({
continueWithIdentity(identity.pubkey);
queryClient.setQueryData(["identity"], identity);
setIdentityWasImported(true);
setImportedNsec(nsec);
setSelectedPubkey(identity.pubkey);
setPage("setup");
},
Expand Down Expand Up @@ -193,6 +195,7 @@ export function MachineOnboardingFlow({
<div className="buzz-onboarding-key-import-position w-full">
<NostrKeyImportForm
backLabel={identityLost ? "Start new identity" : "Back"}
initialNsec={importedNsec}
onBack={
identityLost
? () => void replaceLostIdentity()
Expand Down
5 changes: 4 additions & 1 deletion desktop/src/features/onboarding/ui/NostrKeyImportForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type NostrKeyImportFormProps = {
backLabel?: string;
disabled?: boolean;
errorMessage?: string | null;
/** Prefill when remounting after navigating away (e.g. back from harness setup). */
initialNsec?: string;
onBack: () => void;
onImport: (nsec: string) => Promise<void>;
/** "spotlight" is the first-launch treatment: glowy centered input, no drop zone, pill buttons. */
Expand All @@ -33,11 +35,12 @@ export function NostrKeyImportForm({
backLabel = "Back",
disabled = false,
errorMessage: externalErrorMessage = null,
initialNsec = "",
onBack,
onImport,
variant = "default",
}: NostrKeyImportFormProps) {
const [nsecInput, setNsecInput] = React.useState("");
const [nsecInput, setNsecInput] = React.useState(initialNsec);
const [isImporting, setIsImporting] = React.useState(false);
const [importError, setImportError] = React.useState<string | null>(null);
const [isDragging, setIsDragging] = React.useState(false);
Expand Down