Skip to content
This repository has been archived by the owner on Aug 12, 2021. It is now read-only.

Commit

Permalink
fix: Rename 'Description' with 'Memo' and Add a confirmation dialog f…
Browse files Browse the repository at this point in the history
…or Txs without a memo (#24)
  • Loading branch information
Youngjoon Lee authored Mar 15, 2021
1 parent 05bfcb2 commit f3045b1
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion config/networks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const networks = {
mainnet: { // network name translation t('Mainnet');
name: 'Mainnet',
chainId: 'panacea-1',
chainId: 'panacea-2',
code: 0,
mServerURL: 'https://explorer-server.medibloc.org',
mClientURL: 'https://explorer.medibloc.org',
Expand Down
4 changes: 2 additions & 2 deletions i18n/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
"Decrypt Your Account": "Decrypt Your Account",
"Delegate": "Delegate",
"Deposit": "Deposit",
"Description": "Description",
"Done": "Done",
"Dowload started": "Dowload started",
"Download": "Download",
Expand Down Expand Up @@ -102,6 +101,7 @@
"MediBloc processes personal information as follows.": "MediBloc processes personal information as follows.",
"MediBloc testnet wallet requires an updated version of Internet Explorer or other modern browsers.": "MediBloc testnet wallet requires an updated version of Internet Explorer or other modern browsers.",
"Medibloc Explorer": "Medibloc Explorer",
"Memo": "Memo",
"Minimize": "Minimize",
"Mnemonic is not valid": "Mnemonic is not valid",
"Mnemonic should have 24 words, entered mnemonic has {{length}}": "Mnemonic should have 24 words, entered mnemonic has {{length}}",
Expand Down Expand Up @@ -227,7 +227,7 @@
"What's New...": "What's New...",
"Window": "Window",
"Would you like to proceed with automatic staking?": "Would you like to proceed with automatic staking?",
"Write message (optional)": "Write message (optional)",
"Write a memo (optional)": "Write a memo (optional)",
"Writer": "Writer",
"Wrong Password": "Wrong Password",
"Wrong password.": "Wrong password.",
Expand Down
8 changes: 4 additions & 4 deletions src/actions/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ export const passwordFailed = () => ({
*
*/
export const sent = ({ account, activePeer, amount, chainId,
description, password, to, fee }) =>
memo, password, to, fee }) =>
(dispatch) => {
dispatch(loadingStarted(actionTypes.requestTransferTransaction));
dispatch(passwordVerifying());
send({
account,
activePeer,
chainId,
description,
memo,
password,
to,
fee: toRawMed(fee),
Expand Down Expand Up @@ -202,7 +202,7 @@ export const vested = ({ account, activePeer, amount, chainId,
});
};

export const vestedAndSent = ({ account, activePeer, chainId, description,
export const vestedAndSent = ({ account, activePeer, chainId, memo,
nonce, password, to, transferAmount, vestingAmount }) =>
(dispatch) => {
dispatch(loadingStarted(actionTypes.requestVestAndSendTransaction));
Expand All @@ -220,7 +220,7 @@ export const vestedAndSent = ({ account, activePeer, chainId, description,
account,
activePeer,
chainId,
description,
memo,
nonce: Number(nonce) + 1,
password,
to,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
margin-top: 16px;
}

& .descriptionInfo {
& .memoInfo {
margin-top: 16px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class PasswordSteps extends React.Component {
activePeer: this.props.peers.activePeer,
amount: this.props.amount,
chainId: this.props.peers.chainId,
description: this.props.description,
memo: this.props.memo,
password: this.state.password.value,
to: this.props.recipient,
fee: this.props.fee,
Expand Down Expand Up @@ -158,9 +158,9 @@ class PasswordSteps extends React.Component {
<small className={`${styles.transferFields} ${grid['col-sm-4']}`}>{t('Recipient')}</small>
<h6 className={`${styles.transferBody} ${grid['col-sm-8']}`}>{this.props.recipient}</h6>
</div>
<div className={`${grid.row} ${styles.descriptionInfo}`}>
<small className={`${styles.transferFields} ${grid['col-sm-4']}`}>{t('Description')}</small>
<h6 className={`${styles.transferBody} ${grid['col-sm-8']}`}>{this.props.description}</h6>
<div className={`${grid.row} ${styles.memoInfo}`}>
<small className={`${styles.transferFields} ${grid['col-sm-4']}`}>{t('Memo')}</small>
<h6 className={`${styles.transferBody} ${grid['col-sm-8']}`}>{this.props.memo}</h6>
</div>
</div>
<footer className={`${styles.passwordStepsFooter}`}>
Expand Down
33 changes: 21 additions & 12 deletions src/components/organisms/transfer/send/sendWritable/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class SendWritable extends React.Component {
amount: {
value: this.props.amount || '',
},
description: {
value: this.props.description || '',
memo: {
value: this.props.memo || '',
},
showAutoVesting: false,
vestingAmount: this.props.vestingAmount || 0,
Expand Down Expand Up @@ -73,7 +73,7 @@ class SendWritable extends React.Component {
nextStepWithParam() {
this.props.nextStep({
amount: this.state.amount.value,
description: this.state.description.value,
memo: this.state.memo.value,
recipient: this.state.recipient.value,
fee: this.state.fee,
});
Expand All @@ -89,7 +89,7 @@ class SendWritable extends React.Component {
}

validateInput(name, value) {
if (name === 'description') {
if (name === 'memo') {
if (value.length > 100) {
return this.props.t('Max length exceeded');
}
Expand Down Expand Up @@ -143,13 +143,13 @@ class SendWritable extends React.Component {
value={this.state.recipient.value}
/>
<Input
error={this.state.description.error}
placeholder={t('Write message (optional)')}
onChange={(...args) => this.handleChange('description', ...args)}
parentclassname={`${styles.description}`}
error={this.state.memo.error}
placeholder={t('Write a memo (optional)')}
onChange={(...args) => this.handleChange('memo', ...args)}
parentclassname={`${styles.memo}`}
theme={styles}
title={t('Description')}
value={this.state.description.value}
title={t('Memo')}
value={this.state.memo.value}
/>
</form>
<footer className={`${styles.sendFooter}`}>
Expand All @@ -159,9 +159,18 @@ class SendWritable extends React.Component {
!this.state.recipient.value ||
!!this.state.amount.error ||
!this.state.amount.value ||
!!this.state.description.error)}
!!this.state.memo.error)}
label={t('Next')}
onClick={() => this.nextStepWithParam(false)}
onClick={() => {
if (this.state.memo.value ||
window.confirm('If the recipient is a cryptocurrency exchange (not a personal wallet), they may require a memo. ' +
'In that case, the transfer may not reach the recipient successfully, if you don\'t enter a memo. ' +
'Please check with the exchange to see which memo you need to enter.' +
'\n\nAre you sure to continue without a memo?')
) {
this.nextStepWithParam(false);
}
}}
/>
</footer>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ input:read-only {
}
}

.description {
.memo {
margin: 24px 0 0;

& input {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/api/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const getAccount = (activePeer, address) =>
.catch(err => reject(err))), Promise.resolve());
});

export const send = ({ account, activePeer, chainId, description, password, to, value, fee }) =>
export const send = ({ account, activePeer, chainId, memo, password, to, value, fee }) =>
new Promise((resolve, reject) => {
let mAccount;

Expand All @@ -89,7 +89,7 @@ export const send = ({ account, activePeer, chainId, description, password, to,
sequence: account.sequence,
accountNumber: account.account_number,
chainId,
memo: description,
memo: memo,
fee,
});

Expand Down

0 comments on commit f3045b1

Please # to comment.