From dead04dce8b26a09cb0b451711517bcb4dea182c Mon Sep 17 00:00:00 2001
From: fragosti <francesco.agosti93@gmail.com>
Date: Thu, 19 Jul 2018 04:11:44 -0700
Subject: WIP for sending ether from portal (works)

---
 .../website/ts/components/dialogs/send_dialog.tsx  | 40 +++++++++++++++-------
 1 file changed, 27 insertions(+), 13 deletions(-)

(limited to 'packages/website/ts/components/dialogs/send_dialog.tsx')

diff --git a/packages/website/ts/components/dialogs/send_dialog.tsx b/packages/website/ts/components/dialogs/send_dialog.tsx
index 8a98fdf69..c1179dbd0 100644
--- a/packages/website/ts/components/dialogs/send_dialog.tsx
+++ b/packages/website/ts/components/dialogs/send_dialog.tsx
@@ -6,6 +6,7 @@ import * as React from 'react';
 import { Blockchain } from 'ts/blockchain';
 import { AddressInput } from 'ts/components/inputs/address_input';
 import { TokenAmountInput } from 'ts/components/inputs/token_amount_input';
+import { EthAmountInput } from 'ts/containers/inputs/eth_amount_input';
 import { Token } from 'ts/types';
 
 interface SendDialogProps {
@@ -15,7 +16,7 @@ interface SendDialogProps {
     onComplete: (recipient: string, value: BigNumber) => void;
     onCancelled: () => void;
     isOpen: boolean;
-    token: Token;
+    asset: Token | 'ETH';
     lastForceTokenStateRefetch: number;
 }
 
@@ -58,23 +59,23 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
         );
     }
     private _renderSendDialogBody(): React.ReactNode {
-        return (
-            <div className="mx-auto" style={{ maxWidth: 300 }}>
-                <div style={{ height: 80 }}>
-                    <AddressInput
-                        initialAddress={this.state.recipient}
-                        updateAddress={this._onRecipientChange.bind(this)}
-                        isRequired={true}
-                        label={'Recipient address'}
-                        hintText={'Address'}
-                    />
-                </div>
+        const input =
+            this.props.asset === 'ETH' ? (
+                <EthAmountInput
+                    label="Amount to send"
+                    shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
+                    shouldCheckBalance={true}
+                    shouldShowErrs={true}
+                    onChange={this._onValueChange.bind(this)}
+                    amount={this.state.value}
+                />
+            ) : (
                 <TokenAmountInput
                     blockchain={this.props.blockchain}
                     userAddress={this.props.userAddress}
                     networkId={this.props.networkId}
                     label="Amount to send"
-                    token={this.props.token}
+                    token={this.props.asset}
                     shouldShowIncompleteErrs={this.state.shouldShowIncompleteErrs}
                     shouldCheckBalance={true}
                     shouldCheckAllowance={false}
@@ -82,6 +83,19 @@ export class SendDialog extends React.Component<SendDialogProps, SendDialogState
                     amount={this.state.value}
                     lastForceTokenStateRefetch={this.props.lastForceTokenStateRefetch}
                 />
+            );
+        return (
+            <div className="mx-auto" style={{ maxWidth: 300 }}>
+                <div style={{ height: 80 }}>
+                    <AddressInput
+                        initialAddress={this.state.recipient}
+                        updateAddress={this._onRecipientChange.bind(this)}
+                        isRequired={true}
+                        label="Recipient address'"
+                        hintText="Address"
+                    />
+                </div>
+                {input}
             </div>
         );
     }
-- 
cgit v1.2.3

