Skip to content
Permalink
Browse files

[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
  • Loading branch information...
tomothespian committed Nov 8, 2019
1 parent 844cf69 commit e74eb14888bd1eced1fecc2dc3ca06e20afbe8a6
@@ -73,20 +73,42 @@ type Props = {
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: {
@@ -135,25 +157,18 @@ export default class TransferFundsStep2Dialog extends Component<Props> {

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',
@@ -189,12 +204,12 @@ export default class TransferFundsStep2Dialog extends Component<Props> {
>
{(...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)}
@@ -16,6 +16,11 @@ export default class TransferFundsStep2Container extends Component<Props> {
onClose = () => {
const { onClose } = this.props;
const { transferFundsRequest } = this.props.stores.wallets;

if (transferFundsRequest.isExecuting) {
return;
}

transferFundsRequest.reset();
onClose();
};
@@ -424,6 +424,7 @@ export default class WalletsStore extends Store {
this.refreshWalletsData();
this._transferFundsClose();
this.transferFundsRequest.reset();
this.goToWalletRoute(transferFundsSourceWalletId);
};

@action _transferFundsSetSourceWalletId = ({
@@ -434,7 +435,7 @@ export default class WalletsStore extends Store {
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;
};
@@ -389,7 +389,7 @@ export const CARDANO_THEME_OUTPUT = {
'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)',
@@ -390,7 +390,7 @@ export const DARK_BLUE_THEME_OUTPUT = {
'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)',
@@ -368,12 +368,12 @@ export const DARK_CARDANO_THEME_OUTPUT = {
'#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',
@@ -367,12 +367,12 @@ export const INCENTIVIZED_TESTNET_THEME_OUTPUT = {
'#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',
@@ -386,7 +386,7 @@ export const LIGHT_BLUE_THEME_OUTPUT = {
'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)',
@@ -373,12 +373,12 @@ export const WHITE_THEME_OUTPUT = {
'#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',
@@ -374,12 +374,12 @@ export const YELLOW_THEME_OUTPUT = {
'#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',
},

0 comments on commit e74eb14

Please sign in to comment.
You can’t perform that action at this time.