Skip to content

Commit

Permalink
fixes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeanribeiro committed Mar 3, 2023
1 parent 0ac4aee commit 01a6093
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Button, Icon, Text, RecoveryPhrase, TextType } from '@ui'
import { Button, Icon, RecoveryPhrase, Text, TextType } from '@ui'
import { OnboardingLayout } from '@components'
import { localize } from '@core/i18n'
Expand All @@ -11,16 +11,14 @@
import { Icon as IconEnum } from '@auxiliary/icon'
export let busy: boolean = false
const verifyRecoveryPhrase: Mnemonic = []
const wordElements: HTMLButtonElement[] = []
let wordChoices: string[] = ['', '', '']
let verifyIndex: number = 0
let isVerified: boolean = false
function handleChoice(word: string): void {
function onChoiceClick(word: string): void {
verifyRecoveryPhrase[verifyIndex] = word
if ($onboardingProfile?.mnemonic[verifyIndex] === word) {
if (verifyIndex === $onboardingProfile?.mnemonic.length - 1) {
Expand Down Expand Up @@ -66,7 +64,7 @@

<svelte:window on:keypress={onKeyPress} />

<OnboardingLayout {onBackClick} {busy}>
<OnboardingLayout {onBackClick}>
<title-container slot="title" class="block">
<Text type={TextType.h2} classes={isVerified && 'hidden'}>
{localize('views.onboarding.profileBackup.verifyMnemonic.title')}
Expand All @@ -86,7 +84,7 @@
class="w-full flex flex-row p-4 mb-4 rounded-2xl border border-solid items-center justify-between
border-gray-300 dark:border-gray-700 hover:border-gray-500 dark:hover:border-gray-700
focus:border-gray-500 dark:focus:border-gray-700"
on:click={() => handleChoice(word)}
on:click={() => onChoiceClick(word)}
bind:this={wordElements[i]}
>
<Text smaller classes="ml-3">{`${i + 1}. ${word}`}</Text>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { onMount } from 'svelte'
import { Button, Icon, Text, RecoveryPhrase, TextType } from '@ui'
import { Button, Icon, RecoveryPhrase, Text, TextType } from '@ui'
import { OnboardingLayout } from '@components'
import { localize } from '@core/i18n'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,17 @@
import { profileBackupRouter } from '@/routers'
export let busy: boolean = false
const verifyRecoveryPhrase: Mnemonic = []
let wordChoices: string[] = ['', '', '']
let verifyIndex: number = 0
let isVerified: boolean = false
const title = localize('views.onboarding.profileBackup.verifyMnemonic.title')
$: if (isVerified) {
completeVerification()
}
function handleChoice(word: string): void {
function onChoiceClick(word: string): void {
const wordElement = document.getElementById(`recovery-word-${verifyIndex}`)
wordElement?.scrollIntoView({ behavior: 'smooth', block: 'center' })
verifyRecoveryPhrase[verifyIndex] = word
Expand Down Expand Up @@ -54,7 +50,7 @@
})
</script>

<OnboardingLayout {onBackClick} {busy} {title}>
<OnboardingLayout {onBackClick} title={localize('views.onboarding.profileBackup.verifyMnemonic.title')}>
<content-container slot="content" class="w-full h-full flex flex-col p-0">
{#if !isVerified}
<Text secondary fontSize="15" classes="mb-4">
Expand Down Expand Up @@ -83,7 +79,7 @@
class="w-full flex flex-row p-4 mb-4 rounded-2xl border border-1 border-solid items-center
justify-between border-gray-300 dark:border-gray-700 hover:border-gray-500
dark:hover:border-gray-700 focus:border-gray-500 dark:focus:border-gray-700"
on:click={() => handleChoice(word)}
on:click={() => onChoiceClick(word)}
>
<Text smaller fontSize="15" classes="ml-3" bold>{word}</Text>
<Icon icon={IconEnum.ChevronRight} classes="text-gray-800 dark:text-white" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
import { profileBackupRouter } from '@/routers'
const busy: boolean = false
const title: string = localize('views.onboarding.profileBackup.viewMnemonic.title')
let isHidden: boolean = true
let hasRevealedRecoveryPhrase: boolean = false
Expand All @@ -39,7 +36,7 @@
})
</script>

<OnboardingLayout {onBackClick} {busy} {title}>
<OnboardingLayout {onBackClick} title={localize('views.onboarding.profileBackup.viewMnemonic.title')}>
<content-container slot="content" class="w-full h-full flex flex-col p-0">
<Text type={TextType.p} secondary fontSize="15" classes="mb-4">
{localize('views.onboarding.profileBackup.viewMnemonic.body1')}
Expand Down
6 changes: 3 additions & 3 deletions packages/shared/components/RecoveryPhrase.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
export let recoveryPhrase: string[] = []
export let verifyRecoveryPhrase: string[] = undefined
export let blurred = false
export let disabled = false
export let boxed = false
export let blurred: boolean = false
export let disabled: boolean = false
export let boxed: boolean = false
$: dark = $appSettings.darkMode
</script>
Expand Down

0 comments on commit 01a6093

Please sign in to comment.