Skip to content

Commit e741a49

Browse files
committed
Code Review improvements
1 parent b3d4c76 commit e741a49

File tree

4 files changed

+31
-32
lines changed

4 files changed

+31
-32
lines changed

examples/wallet/app/actions/account.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ export function setKeysWithUnlockWalletPassword(
6262
return function setKeysWithUnlockWalletPasswordThunk(dispatch) {
6363
const accountKeys = readEncryptedAccountInfo(unlockWalletPassword);
6464
if (accountKeys) {
65-
const unlockWalletPasswordKeys = {
66-
unlockWalletPassword
67-
};
68-
dispatch({
69-
type: SET_UNLOCK_WALLET_PASSWORD,
70-
...unlockWalletPasswordKeys
71-
});
72-
7365
return getAccountFromPrivateKey(accountKeys.privateKey).then(keys =>
7466
curry(initializeKeysAndRedirect)(dispatch, keys, unlockWalletPassword)
7567
);
@@ -94,8 +86,8 @@ export function setAccountFromPrivateKey(
9486
])
9587
.then(() => dispatch(push(routes.WALLET)))
9688
.catch(error => {
97-
console.log(error);
98-
dispatch(push(routes.INPUT_KEYS));
89+
console.error(error);
90+
dispatch(push(routes.WALLET));
9991
});
10092
});
10193
};

examples/wallet/app/components/RestoreWalletFromMnemonic.js

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ export default ({ setAccountFromMnemonic }: Props) => {
8282
onBlur={() => checkIsValidMnemonicPhrase()}
8383
/>
8484
<Form.Label className="text-danger" hidden={isMnemonicValid}>
85-
<code>The phrase can have 12, 15, 18, 21 or 24 valid words.</code>
85+
<em className="text-danger">
86+
The phrase can have 12, 15, 18, 21 or 24 valid words.
87+
</em>
8688
</Form.Label>
8789
<Form.Text>
8890
Example:
8991
<br />
90-
<code>
92+
<em className="text-danger">
9193
decade panther require cruise robust mail gadget advice tonight
9294
post inner snack
93-
</code>
95+
</em>
9496
</Form.Text>
9597
<Form.Control
9698
type="password"
@@ -101,8 +103,10 @@ export default ({ setAccountFromMnemonic }: Props) => {
101103
className="mt-3"
102104
/>
103105
<Form.Text>
104-
This secret password is part of the BIP39 standard to generate safer
105-
wallet seeds.
106+
<em className="text-danger">
107+
This secret password is part of the BIP39 standard to generate
108+
safer wallet seeds.
109+
</em>
106110
</Form.Text>
107111
<Form.Label className="mt-5">Unlock wallet (optional):</Form.Label>
108112
<Form.Group>
@@ -116,7 +120,9 @@ export default ({ setAccountFromMnemonic }: Props) => {
116120
onChange={event => setPassword(event.target.value)}
117121
/>
118122
<Form.Label className="text-danger" hidden={isValidPassword}>
119-
<code>The password must have at least 8 chars.</code>
123+
<em className="text-danger">
124+
The password must have at least 8 chars.
125+
</em>
120126
</Form.Label>
121127
<Form.Control
122128
type="password"
@@ -128,14 +134,18 @@ export default ({ setAccountFromMnemonic }: Props) => {
128134
className="mt-3"
129135
/>
130136
<Form.Text>
131-
This key allows you to unlock your wallet every time you start it
132-
and to keep your account data in a more secure way.
137+
<em className="text-danger">
138+
This key allows you to unlock your wallet every time you start
139+
it and to keep your account data in a more secure way.
140+
</em>
133141
</Form.Text>
134142
<Form.Label
135143
className="text-danger"
136144
hidden={arePasswordAndConfirmationEqual}
137145
>
138-
<code>password and confirmation must be the same.</code>
146+
<em className="text-danger">
147+
password and confirmation must be the same.
148+
</em>
139149
</Form.Label>
140150
</Form.Group>
141151
</Form.Group>

examples/wallet/app/components/RestoreWalletFromPrivateKey.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ export default ({ setAccount }: Props) => {
6666
<Form.Text>
6767
It&apos;s a string like:
6868
<br />
69-
<code>
69+
<em className="text-danger">
7070
ed25519e_sk15psr45hyqnpwcl8xd4lv0m32prenhh8kcltgte2305h5jgynndxect9274j0am0qmmd0snjuadnm6xkgssnkn2njvkg8et8qg0vevsgnwvmpl
71-
</code>
71+
</em>
7272
</Form.Text>
73-
<Form.Group>
73+
<Form.Group className="mt-3">
7474
<Form.Control
7575
type="password"
7676
id="password"
@@ -80,8 +80,10 @@ export default ({ setAccount }: Props) => {
8080
isInvalid={!isValidPassword}
8181
onChange={event => setPassword(event.target.value)}
8282
/>
83-
<Form.Label className="text-danger" hidden={isValidPassword}>
84-
<code>The password must have at least 8 chars.</code>
83+
<Form.Label º hidden={isValidPassword}>
84+
<em className="text-danger">
85+
The password must have at least 8 chars.
86+
</em>
8587
</Form.Label>
8688
<Form.Control
8789
type="password"
@@ -96,7 +98,9 @@ export default ({ setAccount }: Props) => {
9698
className="text-danger"
9799
hidden={arePasswordAndConfirmationEqual}
98100
>
99-
<code>Password and confirmation must be the same.</code>
101+
<em className="text-danger">
102+
Password and confirmation must be the same.
103+
</em>
100104
</Form.Label>
101105
</Form.Group>
102106
</Form.Group>

examples/wallet/app/reducers/account.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// @flow
22
import sortBy from 'lodash/sortBy';
33
import {
4-
SET_UNLOCK_WALLET_PASSWORD,
54
SET_KEYS,
65
SET_ACCOUNT_STATE,
76
SEND_TRANSACTION,
@@ -13,7 +12,6 @@ import type {
1312
SendTransactionAction,
1413
SetAccountStateAction,
1514
SetTransactionsAction,
16-
SetKeysWithUnlockWalletPasswordAction,
1715
SendStakeDelegation
1816
} from '../actions/account';
1917
import type { Account } from './types';
@@ -23,7 +21,6 @@ export default function account(
2321
state: Account,
2422
// eslint-disable-next-line flowtype/space-after-type-colon
2523
action:
26-
| SetKeysWithUnlockWalletPasswordAction
2724
| SetKeysAction
2825
| SetAccountStateAction
2926
| SendTransactionAction
@@ -34,10 +31,6 @@ export default function account(
3431
return { transactions: [] };
3532
}
3633
switch (action.type) {
37-
case SET_UNLOCK_WALLET_PASSWORD:
38-
return Object.assign({}, state, {
39-
unlockWalletPassword: action.unlockWalletPassword
40-
});
4134
case SET_KEYS:
4235
return Object.assign({}, state, {
4336
address: action.address,

0 commit comments

Comments
 (0)