-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prices): add market cap to table and fix responsiveness
- Loading branch information
Showing
13 changed files
with
118 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 11 additions & 14 deletions
25
packages/blockchain-wallet-v4-frontend/src/scenes/Prices/Table/balance.column.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
packages/blockchain-wallet-v4-frontend/src/scenes/Prices/Table/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,19 @@ | ||
import { TableColumnsType } from '..' | ||
import { getActionsColumn } from './actions.column' | ||
import { getBalanceColumn } from './balance.column' | ||
import { getMarketCapColumn } from './marketCap.column' | ||
import { getNameColumn } from './name.column' | ||
import { getPriceColumn } from './price.column' | ||
import { getPriceChangeColumn } from './priceChange.column' | ||
|
||
export const getTableColumns = | ||
({ buySellActions, formActions, modalActions, swapActions, walletCurrency }: TableColumnsType) => | ||
({ buySellActions, modalActions, walletCurrency }: TableColumnsType) => | ||
() => | ||
[ | ||
getNameColumn(modalActions), | ||
getPriceColumn(walletCurrency), | ||
getPriceChangeColumn(), | ||
getMarketCapColumn(walletCurrency), | ||
getBalanceColumn(), | ||
getActionsColumn(modalActions, buySellActions, swapActions, formActions) | ||
getActionsColumn(modalActions, buySellActions) | ||
] |
29 changes: 29 additions & 0 deletions
29
packages/blockchain-wallet-v4-frontend/src/scenes/Prices/Table/marketCap.column.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from 'react' | ||
import { FormattedMessage } from 'react-intl' | ||
import BigNumber from 'bignumber.js' | ||
|
||
import { fiatToString } from '@core/exchange/utils' | ||
import { CellHeaderText, CellText } from 'components/Table' | ||
|
||
import { TableColumnsType } from '..' | ||
|
||
export const getMarketCapColumn = (walletCurrency: TableColumnsType['walletCurrency']) => ({ | ||
Cell: ({ row: { original: values } }) => ( | ||
<CellText>{fiatToString({ unit: walletCurrency, value: values.marketCap })}</CellText> | ||
), | ||
Header: () => ( | ||
<CellHeaderText> | ||
<FormattedMessage id='copy.market)_cap' defaultMessage='Market Cap' /> | ||
</CellHeaderText> | ||
), | ||
accessor: 'marketCap', | ||
disableGlobalFilter: true, | ||
sortType: (a, b, id) => { | ||
const aBigNum = new BigNumber(a.original[id]) | ||
const bBigNum = new BigNumber(b.original[id]) | ||
|
||
if (aBigNum.isGreaterThan(bBigNum)) return 1 | ||
if (bBigNum.isGreaterThan(aBigNum)) return -1 | ||
return 0 | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.