Skip to content

Commit

Permalink
fix: refine recovery phrase ux
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Jul 3, 2024
1 parent f75e2e7 commit 1013fdd
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .changeset/nine-clouds-change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'renterd': minor
'walletd': minor
'hostd': minor
---

The user experience around recovery phrase generation and re-generation has been refined.
5 changes: 3 additions & 2 deletions hostd/renderer/components/SeedField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SeedLayout } from './SeedLayout'

export function SeedField() {
const { form, fields, regenerateMnemonic, copySeed } = useConfig()
const mnemonic = form.watch('mnemonic')
return (
<SeedLayout
icon={<SeedIcon />}
Expand All @@ -26,9 +27,9 @@ export function SeedField() {
<div className="flex gap-2">
<Button className="flex-1" onClick={regenerateMnemonic}>
<Redo16 />
Regenerate
{mnemonic ? 'Regenerate' : 'Generate'}
</Button>
<Button className="flex-1" onClick={copySeed}>
<Button disabled={!mnemonic} className="flex-1" onClick={copySeed}>
<Copy16 />
Copy to clipboard
</Button>
Expand Down
2 changes: 1 addition & 1 deletion hostd/renderer/contexts/config/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export function getFields({
event.currentTarget.select()
},
placeholder:
'tent small dress shop wealth fantasy wave mobile hint faith skirt derive',
'Example: tent small dress shop wealth fantasy wave mobile hint faith skirt derive',
validation: {
required: 'required',
validate: {
Expand Down
1 change: 0 additions & 1 deletion hostd/renderer/contexts/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from 'react'
import {
triggerErrorToast,
useOnInvalid,
useFormInit,
useFormServerSynced,
useFormChangeCount,
Expand Down
2 changes: 1 addition & 1 deletion hostd/renderer/contexts/config/useForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function useForm({ resources }: { resources?: Resources }) {
}, [setShowHttpPassword])

const copySeed = useCallback(() => {
copyToClipboard(mnemonic, 'seed')
copyToClipboard(mnemonic, 'recovery phrase')
form.setValue('hasCopied', true, {
shouldDirty: true,
shouldTouch: true,
Expand Down
5 changes: 3 additions & 2 deletions renterd/renderer/components/SeedField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SeedLayout } from './SeedLayout'

export function SeedField() {
const { form, fields, regenerateMnemonic, copySeed } = useConfig()
const mnemonic = form.watch('mnemonic')
return (
<SeedLayout
icon={<SeedIcon />}
Expand All @@ -26,9 +27,9 @@ export function SeedField() {
<div className="flex gap-2">
<Button className="flex-1" onClick={regenerateMnemonic}>
<Redo16 />
Regenerate
{mnemonic ? 'Regenerate' : 'Generate'}
</Button>
<Button className="flex-1" onClick={copySeed}>
<Button disabled={!mnemonic} className="flex-1" onClick={copySeed}>
<Copy16 />
Copy to clipboard
</Button>
Expand Down
2 changes: 1 addition & 1 deletion renterd/renderer/contexts/config/fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export function getFields({
event.currentTarget.select()
},
placeholder:
'tent small dress shop wealth fantasy wave mobile hint faith skirt derive',
'Example: tent small dress shop wealth fantasy wave mobile hint faith skirt derive',
validation: {
required: 'required',
validate: {
Expand Down
1 change: 0 additions & 1 deletion renterd/renderer/contexts/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
} from 'react'
import {
triggerErrorToast,
useOnInvalid,
useFormInit,
useFormServerSynced,
useFormChangeCount,
Expand Down
2 changes: 1 addition & 1 deletion renterd/renderer/contexts/config/useForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function useForm({ resources }: { resources?: Resources }) {
}, [setShowHttpPassword])

const copySeed = useCallback(() => {
copyToClipboard(mnemonic, 'seed')
copyToClipboard(mnemonic, 'recovery phrase')
form.setValue('hasCopied', true, {
shouldDirty: true,
shouldTouch: true,
Expand Down
1 change: 0 additions & 1 deletion walletd/renderer/contexts/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { createContext, useCallback, useContext, useMemo } from 'react'
import {
triggerErrorToast,
useOnInvalid,
useFormInit,
useFormServerSynced,
useFormChangeCount,
Expand Down

0 comments on commit 1013fdd

Please sign in to comment.