[DDW-983] Code improvements, notification button active color, dialog To addresses removed, Dialog close blocked on transfer executing, redirect to summary after executing, Amounts freez on executing and calculation fix
File Changes
onFinish: Function,
onClose: Function,
onBack: Function,
-
addresses: Array<any>,
+
// addresses: Array<any>,
sourceWallet: $Shape<Wallet>,
targetWallet: $Shape<Wallet>,
transferFundsFee: ?number,
isSubmitting?: boolean,
error?: ?LocalizableError,
};
+
type State = {
+
total: number,
+
fees: ?number,
+
amount: ?number,
+
};
+
@observer
-
export default class TransferFundsStep2Dialog extends Component<Props> {
+
export default class TransferFundsStep2Dialog extends Component<Props, State> {
static contextTypes = {
intl: intlShape.isRequired,
};
+
state = {
+
total: formattedWalletAmount(this.props.sourceWallet.amount, false),
+
fees: null,
+
amount: null,
+
};
+
+
componentWillReceiveProps(nextProps) {
+
const { transferFundsFee, sourceWallet } = nextProps;
+
// "FREEZ" current amounts with component state
+
if (transferFundsFee && !this.state.fees && !this.state.amount) {
+
const fees = transferFundsFee.toFormat(DECIMAL_PLACES_IN_ADA);
+
const amount = formattedWalletAmount(sourceWallet.amount.minus(fees), false);
+
this.setState({ fees, amount });
+
}
+
}
+
form = new ReactToolboxMobxForm(
{
fields: {
render() {
const { intl } = this.context;
+
const { total, fees, amount} = this.state;
const {
onClose,
onBack,
-
addresses,
-
transferFundsFee,
+
// addresses,
sourceWallet,
targetWallet,
isSubmitting,
error,
} = this.props;
-
const amount = formattedWalletAmount(sourceWallet.amount, false);
const spendingPasswordField = this.form.$('spendingPassword');
-
let fees = null;
-
let total = null;
-
if (transferFundsFee) {
-
fees = transferFundsFee.toFormat(DECIMAL_PLACES_IN_ADA);
-
total = formattedWalletAmount(sourceWallet.amount.add(fees), false);
-
}
const buttonClasses = classnames([
'confirmButton',
>
{(...content) => <div className={styles.description}>{content}</div>}
</FormattedMessage>
-
<p className={styles.label}>{intl.formatMessage(messages.labelTo)}</p>
+
{/* <p className={styles.label}>{intl.formatMessage(messages.labelTo)}</p>
<ul className={styles.addresses}>
{addresses.map(address => (
<li key={address}>{address}</li>
))}
-
</ul>
+
</ul> */}
<div className={styles.amountGroup}>
<p className={styles.label}>
{intl.formatMessage(messages.labelAmount)}
onClose = () => {
const { onClose } = this.props;
const { transferFundsRequest } = this.props.stores.wallets;
+
+
if (transferFundsRequest.isExecuting) {
+
return;
+
}
+
transferFundsRequest.reset();
onClose();
};
this.refreshWalletsData();
this._transferFundsClose();
this.transferFundsRequest.reset();
+
this.goToWalletRoute(transferFundsSourceWalletId);
};
@action _transferFundsSetSourceWalletId = ({
this.transferFundsSourceWalletId = sourceWalletId;
// Sets the target wallet to the first wallet
const { allWallets } = this;
-
this.transferFundsTargetWalletId = allWallets[0].id;
+
this.transferFundsTargetWalletId = get(allWallets, [0, 'id'], '');
// Sets to first step
this.transferFundsStep = 1;
};
'rgba(250, 251, 252, 0.3)',
'--theme-legacy-notification-learn-more-button-background-color-active':
'rgba(250, 251, 252, 0.4)',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
'rgba(250, 251, 252, 0.9)',
'rgba(250, 251, 252, 0.3)',
'--theme-legacy-notification-learn-more-button-background-color-active':
'rgba(250, 251, 252, 0.4)',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
'rgba(250, 251, 252, 0.9)',
'#1213264d',
'--theme-legacy-notification-learn-more-button-background-color-active':
'#12132666',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
-
'--theme-legacy-notification-move-button-background-color': '#ffffff',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
+
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
'rgba(250, 251, 252, 0.9)',
'--theme-legacy-notification-move-button-background-color-active':
-
'#121326cc',
+
'rgb(250, 251, 252, 0.8)',
'--theme-legacy-notification-title-color': '#ffffff',
'--theme-legacy-notification-description-color': '#ffffff',
'--theme-notification-message-checkmark-icon-color': '#fafbfc',
'#1213264d',
'--theme-legacy-notification-learn-more-button-background-color-active':
'#12132666',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
-
'--theme-legacy-notification-move-button-background-color': '#ffffff',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
+
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
'rgba(250, 251, 252, 0.9)',
'--theme-legacy-notification-move-button-background-color-active':
-
'#121326cc',
+
'rgb(250, 251, 252, 0.8)',
'--theme-legacy-notification-title-color': '#ffffff',
'--theme-legacy-notification-description-color': '#ffffff',
'--theme-notification-message-checkmark-icon-color': '#fafbfc',
'rgba(250, 251, 252, 0.3)',
'--theme-legacy-notification-learn-more-button-background-color-active':
'rgba(250, 251, 252, 0.4)',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
'rgba(250, 251, 252, 0.9)',
'#f9f9f94d',
'--theme-legacy-notification-learn-more-button-background-color-active':
'#f9f9f966',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
-
'#f9f9f9e6',
+
'rgb(250, 251, 252, 0.9)',
'--theme-legacy-notification-move-button-background-color-active':
-
'#f9f9f9cc',
+
'rgb(250, 251, 252, 0.8)',
'--theme-legacy-notification-title-color': '#fafbfc',
'--theme-legacy-notification-description-color': '#fafbfc',
'--theme-notification-message-checkmark-icon-color': '#fafbfc',
'#f8f3ed4d',
'--theme-legacy-notification-learn-more-button-background-color-active':
'#f8f3ed66',
-
'--theme-legacy-notification-move-button-text-color': '#ab2712',
+
'--theme-legacy-notification-move-button-text-color': '#ab1700',
'--theme-legacy-notification-move-button-background-color': '#fafbfc',
'--theme-legacy-notification-move-button-background-color-hover':
-
'#f8f3ede6',
+
'rgb(250, 251, 252, 0.9)',
'--theme-legacy-notification-move-button-background-color-active':
-
'#f8f3edcc',
+
'rgb(250, 251, 252, 0.8)',
'--theme-legacy-notification-title-color': '#fafbfc',
'--theme-legacy-notification-description-color': '#fafbfc',
},