Skip to content

Commit

Permalink
[DDW-500] Send Confirmation adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
thedanheller committed Feb 24, 2021
1 parent 327234e commit fda2bbb
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 28 deletions.
2 changes: 2 additions & 0 deletions source/renderer/app/actions/wallets-actions.js
Expand Up @@ -7,6 +7,7 @@ import type {
} from '../../../common/types/hardware-wallets.types';
import type { CsvFileContent } from '../../../common/types/csv-request.types';
import type { QuitStakePoolRequest } from '../api/staking/types';
import type { WalletSummaryAsset } from '../api/assets/types';

export type WalletImportFromFileParams = {
filePath: string,
Expand Down Expand Up @@ -54,6 +55,7 @@ export default class WalletsActions {
receiver: string,
amount: string,
passphrase: string,
assets?: Array<WalletSummaryAsset>,
}> = new Action();
chooseWalletExportType: Action<{
walletExportType: WalletExportTypeChoices,
Expand Down
Expand Up @@ -119,8 +119,8 @@ messages.fieldIsRequired = globalMessages.fieldIsRequired;
type Props = {
amount: string,
sender: string,
receivers?: Array<string>,
assets?: Array<WalletSummaryAsset>,
receiver: string,
assets: Array<WalletSummaryAsset>,
transactionFee: ?string,
onSubmit: Function,
amountToNaturalUnits: (amountWithFractions: string) => string,
Expand Down Expand Up @@ -197,17 +197,19 @@ export default class WalletAssetsSendConfirmationDialog extends Component<
this.form.submit({
onSuccess: (form) => {
const {
receivers,
receiver,
amount,
amountToNaturalUnits,
isHardwareWallet,
assets,
} = this.props;
const { passphrase } = form.values();
const transactionData = {
receivers,
receiver,
amount: amountToNaturalUnits(amount),
passphrase,
isHardwareWallet,
assets,
};
this.props.onSubmit(transactionData);
},
Expand Down Expand Up @@ -274,7 +276,7 @@ export default class WalletAssetsSendConfirmationDialog extends Component<
onCancel,
sender,
assets,
receivers,
receiver,
transactionFee,
isSubmitting,
isFlight,
Expand Down Expand Up @@ -347,25 +349,15 @@ export default class WalletAssetsSendConfirmationDialog extends Component<
</div>
{assets && (
<div className={styles.addressToLabelWrapper}>
{assets.map((address, addressIndex) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={`${address.policyId}-${addressIndex}`}
className={styles.receiverRow}
>
{assets.map((token, tokenIndex) => (
<div key={token.fingerprint} className={styles.receiverRow}>
<div className={styles.receiverRowItem}>
<h2>
{intl.formatMessage(messages.receiverLabel)}
{assets.length > 1 && (
<div>&nbsp;#{addressIndex + 1}</div>
)}
{assets.length > 1 && <div>&nbsp;#{tokenIndex + 1}</div>}
</h2>
<div className={styles.receiverRowItemAddresses}>
{receivers && (
<div className={styles.addressTo}>
{receivers[addressIndex]}
</div>
)}
{receiver}
<div className={styles.assetsWrapper}>
<div
className={styles.assetsSeparator}
Expand All @@ -379,8 +371,7 @@ export default class WalletAssetsSendConfirmationDialog extends Component<
/>
{assets.map((asset, assetIndex) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={`${asset.policyId}-${assetIndex}`}
key={token.fingerprint}
className={styles.assetsContainer}
>
<h3>
Expand Down
Expand Up @@ -86,7 +86,7 @@ export default class WalletSendConfirmationDialogContainer extends Component<Pro
<WalletAssetsSendConfirmationDialog
amount={amount}
sender={activeWallet.id}
receivers={[receiver]}
receiver={receiver}
assets={assets}
transactionFee={transactionFee}
amountToNaturalUnits={amountToNaturalUnits}
Expand Down
7 changes: 1 addition & 6 deletions storybook/stories/wallets/send/WalletSend.stories.js
Expand Up @@ -298,12 +298,7 @@ storiesOf('Wallets|Send', module)
<WalletAssetsSendConfirmationDialog
amount={new BigNumber(100100).toFormat(DECIMAL_PLACES_IN_ADA)}
sender={generateWallet('Wallet name', '45119903750165', assets).id}
receivers={[
generateHash(),
generateHash(),
generateHash(),
generateHash(),
]}
receivers={generateHash()}
assets={confirmationAssets}
transactionFee={new BigNumber(1).toFormat(DECIMAL_PLACES_IN_ADA)}
amountToNaturalUnits={formattedAmountToNaturalUnits}
Expand Down

0 comments on commit fda2bbb

Please sign in to comment.