Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/main' into mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
anatolse committed Oct 19, 2021
2 parents 9cd8361 + 7efa1a6 commit c6ffa0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/app/model/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const setSeed = createEvent<Seed>();
export const generateSeedFx = createEffect(generateSeed);

export const $seed = restore(setSeed, ['', false] as Seed);
export const $words = $seed.map(([seed]) => seed.split(' '));

$seed.reset(generateSeedFx);
$seed.on(generateSeedFx.doneData, (state, payload) => [payload, false]);
Expand Down
8 changes: 4 additions & 4 deletions src/app/pages/intro/create/SeedConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@ import React, { useState } from 'react';
import { Button, Footer, Window } from 'app/uikit';
import { ArrowRightIcon } from '@app/icons';

import { $ids, $seed, generateSeedFx } from '@app/model/base';
import { $ids, $words, generateSeedFx } from '@app/model/base';
import { useStore } from 'effector-react';
import { setView, View } from '@app/model/view';
import SeedList from '@pages/intro/seed';

const SEED_CONFIRM_COUNT = 6;

const SeedConfirm: React.FC = () => {
const [seed] = useStore($seed);
const seed = useStore($words);
const ids = useStore($ids);

const [errors, setErrors] = useState(
new Array(SEED_CONFIRM_COUNT).fill(null),
);
const valid = errors.every((value) => value === false);
const valid = errors.every((value) => value === true);

const handleInput: React.ChangeEventHandler<HTMLInputElement> = (event) => {
event.preventDefault();
const { name, value } = event.target;
const index = parseInt(name, 10);
const result = seed[index] !== value;
const result = seed[index] === value;
const target = ids.indexOf(index);

if (errors[target] !== result) {
Expand Down

0 comments on commit c6ffa0e

Please sign in to comment.