move token-related localstorage logic to toknes folder

This commit is contained in:
Mikhail Mikheev 2019-03-22 18:27:47 +04:00
parent 67871312a4
commit 5c8dcb1d8f
10 changed files with 19 additions and 7 deletions

5
package-lock.json generated
View File

@ -22452,6 +22452,11 @@
"html-element-attributes": "^1.0.0"
}
},
"react-infinite-scroll-component": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/react-infinite-scroll-component/-/react-infinite-scroll-component-4.5.2.tgz",
"integrity": "sha512-fkCOsAYDx0IHv7pTl9BzSTlNoaFccDzJ3gi2qNgp/D2GxKZKhGwDxqOnZyvMo5e5FhniQ9yaXsTxh/xZg8LuFQ=="
},
"react-input-autosize": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/react-input-autosize/-/react-input-autosize-2.2.1.tgz",

View File

@ -78,6 +78,7 @@
"react-dom": "^16.4.0",
"react-final-form": "^4.1.0",
"react-hot-loader": "^4.8.0",
"react-infinite-scroll-component": "^4.5.2",
"react-redux": "^6.0.1",
"react-router-dom": "^4.3.1",
"recompose": "^0.30.0",

View File

@ -94,8 +94,8 @@ class GnoTable<K> extends React.Component<Props<K>, State> {
this.setState({ page })
}
handleChangeRowsPerPage = (event: SyntheticInputEvent<HTMLInputElement>) => {
const rowsPerPage = Number(event.target.value)
handleChangeRowsPerPage = (e: SyntheticInputEvent<HTMLInputElement>) => {
const rowsPerPage = Number(e.target.value)
this.setState({ rowsPerPage })
}

View File

@ -9,4 +9,10 @@ const enableToken = createAction(ENABLE_TOKEN, (safeAddress: string, token: Toke
address: token.get('address'),
}))
export default enableToken
const setTokenEnabled = (safeAddress: string, token: Token) => (dispatch: ReduxDispatch<GlobalState>) => {
dispatch(enableToken(safeAddress, token))
}
export default setTokenEnabled

View File

@ -8,7 +8,7 @@ import { getWeb3 } from '~/logic/wallets/getWeb3'
import { type GlobalState } from '~/store/index'
import { makeToken, type Token, type TokenProps } from '~/logic/tokens/store/model/token'
import { ensureOnce } from '~/utils/singleton'
import { getActiveTokenAddresses, getTokens } from '~/utils/localStorage/tokens'
import { getActiveTokenAddresses, getTokens } from '~/logic/tokens/utils/activeTokensStorage'
import { getSafeEthToken } from '~/utils/tokens'
import { enhancedFetch } from '~/utils/fetch'
import addTokens from './addTokens'

View File

@ -12,7 +12,7 @@ import {
getActiveTokenAddresses,
setToken,
removeTokenFromStorage,
} from '~/utils/localStorage/tokens'
} from '~/logic/tokens/utils/activeTokensStorage'
import { ensureOnce } from '~/utils/singleton'
import { calculateActiveErc20TokensFrom } from '~/utils/tokens'

View File

@ -4,6 +4,7 @@ import { connect } from 'react-redux'
import { List } from 'immutable'
import classNames from 'classnames/bind'
import SearchBar from 'material-ui-search-bar'
import InfiniteScroll from 'react-infinite-scroll-component'
import { withStyles } from '@material-ui/core/styles'
import MuiList from '@material-ui/core/List'
import Img from '~/components/layout/Img'

View File

@ -26,7 +26,6 @@ export const getBalanceData = (activeTokens: List<Token>): Array<BalanceRow> =>
return Array.from(rows)
}
export const generateColumns = () => {
const assetRow: Column = {
id: BALANCE_TABLE_ASSET_ID,

View File

@ -11,7 +11,7 @@ import { travelToTokens } from '~/test/builder/safe.dom.utils'
import { sleep } from '~/utils/timer'
import { buildMathPropsFrom } from '~/test/utils/buildReactRouterProps'
import { tokenListSelector, activeTokensSelector } from '~/logic/tokens/store/selectors'
import { getActiveTokenAddresses } from '~/utils/localStorage/tokens'
import { getActiveTokenAddresses } from '~/logic/tokens/utils/activeTokensStorage'
import { enableFirstToken, testToken } from '~/test/builder/tokens.dom.utils'
import * as fetchTokensModule from '~/logic/tokens/store/actions/fetchTokens'
import * as enhancedFetchModule from '~/utils/fetch'