diff options
| author | Fabio Berger <me@fabioberger.com> | 2018-06-01 01:45:34 +0800 |
|---|---|---|
| committer | Fabio Berger <me@fabioberger.com> | 2018-06-01 01:45:34 +0800 |
| commit | 94ee82e076d85b64063b5c71be13b1ebe0bb8c10 (patch) | |
| tree | 53524249da4c5b907e1489d8677a7cc1edf069a2 /packages/website/ts/components/wallet/wallet.tsx | |
| parent | 0beab9eec45508fb6163bd6c0fd3970f0b61a91d (diff) | |
| parent | 5b31d0aa3635ea524fb42d73cd6c713887dfef6a (diff) | |
| download | dexon-sol-tools-94ee82e076d85b64063b5c71be13b1ebe0bb8c10.tar.gz dexon-sol-tools-94ee82e076d85b64063b5c71be13b1ebe0bb8c10.tar.zst dexon-sol-tools-94ee82e076d85b64063b5c71be13b1ebe0bb8c10.zip | |
Merge branch 'v2-prototype' into refactor/order-utils/for-v2
* v2-prototype: (45 commits)
Check length before accessing indices, add awaitTransactionSuccess where needed, and rename function
Add back before/after snapshots for each test
Rename Signer to Wallet, rename GAS_ESTIMATE to GAS_LIMIT
Make preSigned and allowedValidators mappings public
Change names of signature types
Fix formatting and tests
Make AssetProxyId last byte of assetData
Add signer to txHash, allow approveValidator to be used with executeTransaction
Update Whitelist
Fix Exchange interface
Increase block gas limit
Use last byte of signature as signature type
Remove TxOrigin signature type, modify whitelist to use Validator signature type
Update Whitelist contract with comments, also require maker to be whitelisted
Fix build
Add example whitelist contract and minimum tests
Add sample whitelist contract
Add TxOrigin signature type and rearrange order of types
Add approveValidator function
Add Validator signature type
...
# Conflicts:
# packages/contracts/src/contracts/current/protocol/Exchange/MixinSignatureValidator.sol
# packages/contracts/src/utils/types.ts
# packages/contracts/test/exchange/transactions.ts
# packages/order-utils/src/asset_proxy_utils.ts
Diffstat (limited to 'packages/website/ts/components/wallet/wallet.tsx')
| -rw-r--r-- | packages/website/ts/components/wallet/wallet.tsx | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/packages/website/ts/components/wallet/wallet.tsx b/packages/website/ts/components/wallet/wallet.tsx index 10ee31619..30d1285f4 100644 --- a/packages/website/ts/components/wallet/wallet.tsx +++ b/packages/website/ts/components/wallet/wallet.tsx @@ -46,6 +46,7 @@ import { import { backendClient } from 'ts/utils/backend_client'; import { colors } from 'ts/utils/colors'; import { constants } from 'ts/utils/constants'; +import { zIndex } from 'ts/utils/style'; import { utils } from 'ts/utils/utils'; import { styles as walletItemStyles } from 'ts/utils/wallet_item_styles'; @@ -88,6 +89,8 @@ interface AccessoryItemConfig { const styles: Styles = { root: { width: '100%', + zIndex: zIndex.aboveOverlay, + position: 'relative', }, headerItemInnerDiv: { paddingLeft: 65, @@ -129,9 +132,6 @@ const styles: Styles = { }; const ETHER_ICON_PATH = '/images/ether.png'; -const ETHER_TOKEN_SYMBOL = 'WETH'; -const ZRX_TOKEN_SYMBOL = 'ZRX'; -const ETHER_SYMBOL = 'ETH'; const ICON_DIMENSION = 24; const TOKEN_AMOUNT_DISPLAY_PRECISION = 3; const BODY_ITEM_KEY = 'BODY'; @@ -322,7 +322,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { const primaryText = this._renderAmount( this.props.userEtherBalanceInWei, constants.DECIMAL_PLACES_ETH, - ETHER_SYMBOL, + constants.ETHER_SYMBOL, ); const etherToken = this._getEthToken(); const etherPrice = this.state.trackedTokenStateByAddress[etherToken.address].price; @@ -341,13 +341,13 @@ export class Wallet extends React.Component<WalletProps, WalletState> { ? { ...walletItemStyles.focusedItem, ...styles.paddedItem } : { ...styles.tokenItem, ...styles.borderedItem, ...styles.paddedItem }; const key = ETHER_ITEM_KEY; - return this._renderBalanceRow(key, icon, primaryText, secondaryText, accessoryItemConfig); + return this._renderBalanceRow(key, icon, primaryText, secondaryText, accessoryItemConfig, 'eth-row'); } private _renderTokenRows(): React.ReactNode { const trackedTokens = this.props.trackedTokens; const trackedTokensStartingWithEtherToken = trackedTokens.sort( - firstBy((t: Token) => t.symbol !== ETHER_TOKEN_SYMBOL) - .thenBy((t: Token) => t.symbol !== ZRX_TOKEN_SYMBOL) + firstBy((t: Token) => t.symbol !== constants.ETHER_TOKEN_SYMBOL) + .thenBy((t: Token) => t.symbol !== constants.ZRX_TOKEN_SYMBOL) .thenBy('address'), ); return _.map(trackedTokensStartingWithEtherToken, this._renderTokenRow.bind(this)); @@ -362,7 +362,8 @@ export class Wallet extends React.Component<WalletProps, WalletState> { const icon = <TokenIcon token={token} diameter={ICON_DIMENSION} link={tokenLink} />; const primaryText = this._renderAmount(tokenState.balance, token.decimals, token.symbol); const secondaryText = this._renderValue(tokenState.balance, token.decimals, tokenState.price); - const wrappedEtherDirection = token.symbol === ETHER_TOKEN_SYMBOL ? Side.Receive : undefined; + const isWeth = token.symbol === constants.ETHER_TOKEN_SYMBOL; + const wrappedEtherDirection = isWeth ? Side.Receive : undefined; const accessoryItemConfig: AccessoryItemConfig = { wrappedEtherDirection, allowanceToggleConfig: { @@ -371,7 +372,14 @@ export class Wallet extends React.Component<WalletProps, WalletState> { }, }; const key = token.address; - return this._renderBalanceRow(key, icon, primaryText, secondaryText, accessoryItemConfig); + return this._renderBalanceRow( + key, + icon, + primaryText, + secondaryText, + accessoryItemConfig, + isWeth ? 'weth-row' : undefined, + ); } private _renderBalanceRow( key: string, @@ -379,6 +387,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { primaryText: React.ReactNode, secondaryText: React.ReactNode, accessoryItemConfig: AccessoryItemConfig, + className?: string, ): React.ReactNode { const shouldShowWrapEtherItem = !_.isUndefined(this.state.wrappedEtherDirection) && @@ -388,7 +397,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> { : { ...styles.tokenItem, ...styles.borderedItem, ...styles.paddedItem }; const etherToken = this._getEthToken(); return ( - <div key={key} className="flex flex-column"> + <div key={key} className={`flex flex-column ${className || ''}`}> <div className="flex items-center" style={style}> <div className="px2">{icon}</div> <div className="flex-none pr2 pt2 pb2"> @@ -578,8 +587,6 @@ export class Wallet extends React.Component<WalletProps, WalletState> { }); } private _getEthToken(): Token { - const tokens = _.values(this.props.tokenByAddress); - const etherToken = _.find(tokens, { symbol: ETHER_TOKEN_SYMBOL }); - return etherToken; + return utils.getEthToken(this.props.tokenByAddress); } } // tslint:disable:max-file-line-count |
