diff options
author | Brandon Millman <brandon@0xproject.com> | 2018-06-29 01:47:43 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-29 01:47:43 +0800 |
commit | 0fcbd02d50bd564a9c888f247a4b0a565d928cc6 (patch) | |
tree | 5212c6e17bf377bbdf3b5dc3053c9a55e58ba044 /packages/website/ts/components/portal/portal.tsx | |
parent | 988a3347582cd812aadeaa0cdaef67389c8d833d (diff) | |
parent | 4969797c2327ba0eb92a9723842ab312b6631008 (diff) | |
download | dexon-0x-contracts-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.gz dexon-0x-contracts-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.tar.zst dexon-0x-contracts-0fcbd02d50bd564a9c888f247a4b0a565d928cc6.zip |
Merge pull request #762 from 0xProject/feature/website/scroll-to-token
Sort wallet tokens by timestamp added and scroll to newly added token
Diffstat (limited to 'packages/website/ts/components/portal/portal.tsx')
-rw-r--r-- | packages/website/ts/components/portal/portal.tsx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/packages/website/ts/components/portal/portal.tsx b/packages/website/ts/components/portal/portal.tsx index 4166fde53..9498cb388 100644 --- a/packages/website/ts/components/portal/portal.tsx +++ b/packages/website/ts/components/portal/portal.tsx @@ -192,7 +192,7 @@ export class Portal extends React.Component<PortalProps, PortalState> { this._fetchBalancesAndAllowancesAsync(trackedTokenAddresses); } - const nextTrackedTokens = this._getTrackedTokens(nextProps.tokenByAddress); + const nextTrackedTokens = utils.getTrackedTokens(nextProps.tokenByAddress); const trackedTokens = this._getCurrentTrackedTokens(); if (!_.isEqual(nextTrackedTokens, trackedTokens)) { @@ -563,9 +563,9 @@ export class Portal extends React.Component<PortalProps, PortalState> { if (this.state.tokenManagementState === TokenManagementState.Remove && !isDefaultTrackedToken) { if (token.isRegistered) { // Remove the token from tracked tokens - const newToken = { + const newToken: Token = { ...token, - isTracked: false, + trackedTimestamp: undefined, }; this.props.dispatcher.updateTokenByAddress([newToken]); } else { @@ -610,13 +610,7 @@ export class Portal extends React.Component<PortalProps, PortalState> { } private _getCurrentTrackedTokens(): Token[] { - return this._getTrackedTokens(this.props.tokenByAddress); - } - - private _getTrackedTokens(tokenByAddress: TokenByAddress): Token[] { - const allTokens = _.values(tokenByAddress); - const trackedTokens = _.filter(allTokens, t => t.isTracked); - return trackedTokens; + return utils.getTrackedTokens(this.props.tokenByAddress); } private _getInitialTrackedTokenStateByAddress(trackedTokens: Token[]): TokenStateByAddress { |