From 03e42057007d3075e451d7cea92968b4c6514e31 Mon Sep 17 00:00:00 2001
From: Fabio Berger <me@fabioberger.com>
Date: Tue, 3 Apr 2018 15:39:43 +0900
Subject: Remove Dharma integration from Website

---
 packages/website/ts/components/token_balances.tsx | 69 -----------------------
 1 file changed, 69 deletions(-)

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

diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx
index b4a710ef4..618b5fe8f 100644
--- a/packages/website/ts/components/token_balances.tsx
+++ b/packages/website/ts/components/token_balances.tsx
@@ -8,7 +8,6 @@ import {
     utils as sharedUtils,
 } from '@0xproject/react-shared';
 import { BigNumber, logUtils } from '@0xproject/utils';
-import DharmaLoanFrame from 'dharma-loan-frame';
 import * as _ from 'lodash';
 import Dialog from 'material-ui/Dialog';
 import Divider from 'material-ui/Divider';
@@ -79,7 +78,6 @@ interface TokenBalancesProps {
 interface TokenBalancesState {
     errorType: BalanceErrs;
     isBalanceSpinnerVisible: boolean;
-    isDharmaDialogVisible: boolean;
     isZRXSpinnerVisible: boolean;
     isTokenPickerOpen: boolean;
     isAddingToken: boolean;
@@ -96,7 +94,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
             errorType: undefined,
             isBalanceSpinnerVisible: false,
             isZRXSpinnerVisible: false,
-            isDharmaDialogVisible: DharmaLoanFrame.isAuthTokenPresent(),
             isTokenPickerOpen: false,
             isAddingToken: false,
             trackedTokenStateByAddress: initialTrackedTokenStateByAddress,
@@ -168,20 +165,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
                 onTouchTap={this._onErrorDialogToggle.bind(this, false)}
             />,
         ];
-        const dharmaDialogActions = [
-            <FlatButton
-                key="dharmaCloseBtn"
-                label="Close"
-                primary={true}
-                onTouchTap={this._onDharmaDialogToggle.bind(this, false)}
-            />,
-        ];
         const isTestNetwork = utils.isTestNetwork(this.props.networkId);
         const isKovanTestNetwork = this.props.networkId === constants.NETWORK_ID_KOVAN;
-        const dharmaButtonColumnStyle = {
-            paddingLeft: 3,
-            display: isKovanTestNetwork ? 'table-cell' : 'none',
-        };
         const stubColumnStyle = {
             display: isTestNetwork ? 'none' : 'table-cell',
         };
@@ -190,11 +175,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
             allTokenRowHeight < MAX_TOKEN_TABLE_HEIGHT ? allTokenRowHeight : MAX_TOKEN_TABLE_HEIGHT;
         const isSmallScreen = this.props.screenWidth === ScreenWidths.Sm;
         const tokenColSpan = isSmallScreen ? TOKEN_COL_SPAN_SM : TOKEN_COL_SPAN_LG;
-        const dharmaLoanExplanation =
-            'If you need access to larger amounts of ether,<br> \
-                                     you can request a loan from the Dharma Loan<br> \
-                                     network.  Your loan should be funded in 5<br>  \
-                                     minutes or less.';
         const allowanceExplanation =
             '0x smart contracts require access to your<br> \
                                   token balances in order to execute trades.<br> \
@@ -226,12 +206,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
                                     {isSmallScreen ? 'Faucet' : 'Request from faucet'}
                                 </TableHeaderColumn>
                             )}
-                            {isKovanTestNetwork && (
-                                <TableHeaderColumn style={dharmaButtonColumnStyle}>
-                                    {isSmallScreen ? 'Loan' : 'Request Dharma loan'}
-                                    <HelpTooltip style={{ paddingLeft: 4 }} explanation={dharmaLoanExplanation} />
-                                </TableHeaderColumn>
-                            )}
                         </TableRow>
                     </TableHeader>
                     <TableBody displayRowCheckbox={false}>
@@ -258,15 +232,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
                                     />
                                 </TableRowColumn>
                             )}
-                            {isKovanTestNetwork && (
-                                <TableRowColumn style={dharmaButtonColumnStyle}>
-                                    <RaisedButton
-                                        label="Request"
-                                        style={{ width: '100%' }}
-                                        onTouchTap={this._onDharmaDialogToggle.bind(this)}
-                                    />
-                                </TableRowColumn>
-                            )}
                         </TableRow>
                     </TableBody>
                 </Table>
@@ -315,17 +280,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
                 >
                     {this._renderErrorDialogBody()}
                 </Dialog>
-                <Dialog
-                    title="Request Dharma Loan"
-                    titleStyle={{ fontWeight: 100, backgroundColor: colors.white }}
-                    bodyStyle={{ backgroundColor: colors.dharmaDarkGrey }}
-                    actionsContainerStyle={{ backgroundColor: colors.white }}
-                    autoScrollBodyContent={true}
-                    actions={dharmaDialogActions}
-                    open={this.state.isDharmaDialogVisible}
-                >
-                    {this._renderDharmaLoanFrame()}
-                </Dialog>
                 <AssetPicker
                     userAddress={this.props.userAddress}
                     networkId={this.props.networkId}
@@ -545,24 +499,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
                 throw utils.spawnSwitchErr('errorType', this.state.errorType);
         }
     }
-    private _renderDharmaLoanFrame() {
-        if (sharedUtils.isUserOnMobile()) {
-            return (
-                <h4 style={{ textAlign: 'center' }}>
-                    We apologize -- Dharma loan requests are not available on mobile yet. Please try again through your
-                    desktop browser.
-                </h4>
-            );
-        } else {
-            return (
-                <DharmaLoanFrame
-                    partner="0x"
-                    env={utils.getCurrentEnvironment()}
-                    screenWidth={this.props.screenWidth}
-                />
-            );
-        }
-    }
     private _onErrorOccurred(errorType: BalanceErrs) {
         this.setState({
             errorType,
@@ -646,11 +582,6 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
             errorType: undefined,
         });
     }
-    private _onDharmaDialogToggle() {
-        this.setState({
-            isDharmaDialogVisible: !this.state.isDharmaDialogVisible,
-        });
-    }
     private _onAddTokenClicked() {
         this.setState({
             isTokenPickerOpen: true,
-- 
cgit v1.2.3

