diff --git a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx index 61264c67..b7d17e78 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/TokenSelectField/index.jsx @@ -1,5 +1,5 @@ // @flow -import React, { useEffect, useState } from 'react' +import React from 'react' import { List } from 'immutable' import { withStyles } from '@material-ui/core/styles' import MenuItem from '@material-ui/core/MenuItem' @@ -22,63 +22,57 @@ type SelectFieldProps = { } type SelectedTokenProps = { - token?: Token, + tokenAddress?: string, classes: Object, + tokens: List, } -const SelectedToken = ({ token, classes }: SelectedTokenProps) => ( - - {token ? ( - <> - - {token.name} - - - - ) : ( - - Select an asset* - - )} - -) - -const SelectedTokenStyled = withStyles(selectedTokenStyles)(SelectedToken) - -type InitialTokenType = Token | string - -const TokenSelectField = ({ tokens, classes, initialValue }: SelectFieldProps) => { - const [initialToken, setInitialToken] = useState('') - - useEffect(() => { - const selectedToken = tokens.find((token) => token.name === initialValue) - setInitialToken(selectedToken || '') - }, [initialValue]) +const SelectedToken = ({ tokenAddress, tokens, classes }: SelectedTokenProps) => { + const token = tokens.find(({ address }) => address === tokenAddress) return ( - } - initialValue={initialToken} - displayEmpty - > - {tokens.map((token) => ( - - + + {token ? ( + <> + {token.name} - - - ))} - + + + ) : ( + + Select an asset* + + )} + ) } +const SelectedTokenStyled = withStyles(selectedTokenStyles)(SelectedToken) + +const TokenSelectField = ({ tokens, classes, initialValue }: SelectFieldProps) => ( + } + initialValue={initialValue} + displayEmpty + > + {tokens.map((token) => ( + + + {token.name} + + + + ))} + +) + export default withStyles(selectStyles)(TokenSelectField) diff --git a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx index 61c02502..976908ed 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/SendFunds/index.jsx @@ -96,7 +96,8 @@ const SendFunds = ({ {(...args) => { const formState = args[2] const mutators = args[3] - const { token } = formState.values + const { token: tokenAddress } = formState.values + const selectedTokenRecord = tokens.find((token) => token.address === tokenAddress) const handleScan = (value) => { let scannedAddress = value @@ -170,14 +171,14 @@ const SendFunds = ({ required, mustBeFloat, greaterThan(0), - maxValue(token && token.balance), + maxValue(selectedTokenRecord && selectedTokenRecord.balance), )} placeholder="Amount*" text="Amount*" className={classes.addressInput} inputAdornment={ - token && { - endAdornment: {token.symbol}, + selectedTokenRecord && { + endAdornment: {selectedTokenRecord.symbol}, } } /> diff --git a/src/routes/safe/components/Balances/dataFetcher.js b/src/routes/safe/components/Balances/dataFetcher.js index 11b5c509..af3a146c 100644 --- a/src/routes/safe/components/Balances/dataFetcher.js +++ b/src/routes/safe/components/Balances/dataFetcher.js @@ -18,7 +18,7 @@ export type BalanceRow = SortRow export const getBalanceData = (activeTokens: List): List => { const rows = activeTokens.map((token: Token) => ({ - [BALANCE_TABLE_ASSET_ID]: { name: token.name, logoUri: token.logoUri }, + [BALANCE_TABLE_ASSET_ID]: { name: token.name, logoUri: token.logoUri, address: token.address }, [buildOrderFieldFrom(BALANCE_TABLE_ASSET_ID)]: token.name, [BALANCE_TABLE_BALANCE_ID]: `${formatAmount(token.balance)} ${token.symbol}`, [buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: Number(token.balance), diff --git a/src/routes/safe/components/Balances/index.jsx b/src/routes/safe/components/Balances/index.jsx index 6f67212b..575f9e8a 100644 --- a/src/routes/safe/components/Balances/index.jsx +++ b/src/routes/safe/components/Balances/index.jsx @@ -71,11 +71,11 @@ class Balances extends React.Component { this.setState(() => ({ [`show${action}`]: false })) } - showSendFunds = (token: Token) => { + showSendFunds = (tokenAddress: string) => { this.setState({ sendFunds: { isOpen: true, - selectedToken: token, + selectedToken: tokenAddress, }, }) } @@ -174,7 +174,7 @@ class Balances extends React.Component { size="small" color="primary" className={classes.send} - onClick={() => this.showSendFunds(row.asset.name)} + onClick={() => this.showSendFunds(row.asset.address)} testId="balance-send-btn" > diff --git a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx index f15e5183..0764066a 100644 --- a/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx +++ b/src/routes/safe/components/Settings/ManageOwners/ReplaceOwnerModal/screens/Review/index.jsx @@ -47,7 +47,7 @@ const ReviewRemoveOwner = ({ <> - Replace owner + Replace owner 2 of 2 @@ -61,12 +61,12 @@ const ReviewRemoveOwner = ({ - Details + Details - Safe name + Safe name {safeName} @@ -74,7 +74,7 @@ const ReviewRemoveOwner = ({ - Any transaction requires the confirmation of: + Any transaction requires the confirmation of: {`${threshold} out of ${owners.size} owner(s)`} @@ -90,34 +90,35 @@ const ReviewRemoveOwner = ({ {owners.map( - (owner) => owner.address !== ownerAddress && ( - - - - - - - - - {owner.name} - - - - {owner.address} + (owner) => + owner.address !== ownerAddress && ( + + + + + + + + + {owner.name} - - + + + {owner.address} + + + + - - - - - - ), + + + + + ), )} - REMOVING OWNER ↓ + REMOVING OWNER ↓ @@ -142,7 +143,7 @@ const ReviewRemoveOwner = ({ - ADDING NEW OWNER ↓ + ADDING NEW OWNER ↓ @@ -170,9 +171,13 @@ const ReviewRemoveOwner = ({ + + Yooo + +