Skip to content

Commit dce4b66

Browse files
author
Maurice Dalderup
authored
Merge pull request #1287 from nos/develop
[RELEASE] 0.6.2
2 parents cba0135 + 66a8d40 commit dce4b66

File tree

9 files changed

+149
-12
lines changed

9 files changed

+149
-12
lines changed

CHANGELOG.md

+101
Large diffs are not rendered by default.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"repository": "https://www.github.com/nos/client",
55
"author": "nOS",
66
"homepage": "https://nos.io",
7-
"version": "0.6.0",
7+
"version": "0.6.2",
88
"private": true,
99
"main": "dist/main/main.js",
1010
"license": "MIT",

src/renderer/account/components/Management/Wallet/Wallet.js

+26-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import styles from './Wallet.scss';
2020
import EncryptedInput from '../EncryptedInput';
2121

2222
export default class Wallet extends React.PureComponent {
23+
labelRef = React.createRef();
24+
2325
static propTypes = {
2426
className: string,
2527
wallet: walletShape.isRequired,
@@ -28,7 +30,8 @@ export default class Wallet extends React.PureComponent {
2830
account: accountShape.isRequired,
2931
confirm: func.isRequired,
3032
changeActiveWallet: func.isRequired,
31-
updateWallet: func.isRequired
33+
updateWallet: func.isRequired,
34+
showErrorToast: func.isRequired
3235
};
3336

3437
static defaultProps = {
@@ -84,6 +87,10 @@ export default class Wallet extends React.PureComponent {
8487
contentEditable="true"
8588
onBlur={this.handleChangeLabel}
8689
suppressContentEditableWarning="true"
90+
onKeyPress={this.validateLabel}
91+
role="textbox"
92+
tabIndex={0}
93+
ref={this.labelRef}
8794
>
8895
{wallet.walletLabel || 'Wallet'}
8996
</div>
@@ -131,9 +138,16 @@ export default class Wallet extends React.PureComponent {
131138

132139
handleChangeLabel = (e) => {
133140
const { wallet, account, updateWallet } = this.props;
141+
142+
const newLabel = e.target.textContent;
143+
if (newLabel.length > 31) {
144+
e.preventDefault();
145+
return;
146+
}
147+
134148
const newWallet = {
135149
...wallet,
136-
walletLabel: e.target.innerHTML
150+
walletLabel: newLabel
137151
};
138152

139153
updateWallet({ account, wallet: newWallet });
@@ -142,7 +156,6 @@ export default class Wallet extends React.PureComponent {
142156
handleSetPrimary = () => {
143157
const { wallet, account, passphrase, changeActiveWallet, setPassphrase } = this.props;
144158
const { walletId } = wallet;
145-
146159
changeActiveWallet({ account, passphrase, walletId });
147160
setPassphrase('');
148161
};
@@ -151,6 +164,16 @@ export default class Wallet extends React.PureComponent {
151164
this.props.setPassphrase(event.target.value);
152165
};
153166

167+
validateLabel = (e) => {
168+
if (e.target.textContent.length > 30) {
169+
e.preventDefault();
170+
return this.props.showErrorToast('Wallet label cannot be longer than 30 characters.');
171+
} else if (e.key === 'Enter') {
172+
e.preventDefault();
173+
this.labelRef.current.blur();
174+
}
175+
};
176+
154177
showConfirm = () => {
155178
const { account, setPassphrase, confirm, wallet } = this.props;
156179
const { secretWord, activeWalletId } = account;

src/renderer/auth/actions/authActions.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { createActions } from 'spunky';
2+
import { omit } from 'lodash';
23

34
import { getActiveWalletForAccount } from 'shared/wallet/WalletHelpers';
45
import Wallet from 'shared/wallet';
6+
import { ID as ACCOUNT_ID } from 'auth/actions/accountActions';
7+
import { updateStorage } from 'shared/lib/storage';
58

69
export const ID = 'auth';
710

@@ -21,12 +24,14 @@ const authenticate = async ({ account, passphrase }) => {
2124
};
2225
};
2326

24-
const changeActiveWallet = ({ account, passphrase, walletId }) => {
27+
const changeActiveWallet = async ({ account, passphrase, walletId }) => {
2528
const updatedAccount = {
26-
...account,
29+
...omit(account, 'wallet'),
2730
activeWalletId: walletId
2831
};
2932

33+
await updateStorage(ACCOUNT_ID, account.accountLabel, updatedAccount);
34+
3035
return authenticate({ account: updatedAccount, passphrase });
3136
};
3237

src/renderer/auth/actions/walletActions.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ export const importWalletActions = createActions(
3636
// Setter - Update Wallet
3737
export const updateWalletActions = createActions(ID, ({ account, wallet }) => async () => {
3838
const { accountLabel } = account;
39-
await storeWalletForAccount({ accountLabel, wallet, update: true });
39+
await storeWalletForAccount({
40+
accountLabel,
41+
wallet,
42+
update: true,
43+
omitItems: !wallet.isImport
44+
});
4045
return getWalletsForAccount({ accountLabel });
4146
});

src/renderer/browser/values/browserValues.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ export const EXTERNAL = 1;
33

44
export const APPSTORE = 'App Store';
55
export const ACCOUNT = 'Account';
6-
export const EXCHANGE = 'https://exchange.nash.io/';
6+
export const EXCHANGE = 'https://switcheo.exchange/markets/NOS_NEO';
77
export const SETTINGS = 'Settings';

src/renderer/root/components/AuthenticatedLayout/Navigation/Navigation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default class Navigation extends React.PureComponent {
3131
};
3232

3333
render() {
34-
const matchExchange = (url) => /https:\/\/exchange\.nash\.io.+/i.test(url);
34+
const matchExchange = (url) => /https:\/\/switcheo\.exchange.+/i.test(url);
3535
const { authenticated } = this.props;
3636

3737
return (

src/renderer/root/components/AuthenticatedLayout/Tabs/Tabs.scss

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
flex: 0 1 330px;
1717
}
1818

19+
img {
20+
overflow: hidden;
21+
}
22+
1923
.newTab {
2024
align-self: center;
2125
min-width: 16px;
Loading

0 commit comments

Comments
 (0)