balances sorting fixes wip
This commit is contained in:
parent
f5de843a26
commit
6c5711d6d9
|
@ -16,7 +16,6 @@ export type Column = {
|
||||||
custom: boolean, // If content will be rendered by user manually
|
custom: boolean, // If content will be rendered by user manually
|
||||||
width?: number,
|
width?: number,
|
||||||
static?: boolean, // If content can't be sorted by values in the column
|
static?: boolean, // If content can't be sorted by values in the column
|
||||||
sortKey?: string, // If value of the column is an object
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const cellWidth = (width: number | typeof undefined) => {
|
export const cellWidth = (width: number | typeof undefined) => {
|
||||||
|
|
|
@ -39,7 +39,7 @@ export const stableSort = (dataArray: List<any>, cmp: any, fixed: boolean): Arra
|
||||||
return a[1] - b[1]
|
return a[1] - b[1]
|
||||||
})
|
})
|
||||||
|
|
||||||
const sortedElems: Array<SortRow> = stabilizedThis.map(el => el[0])
|
const sortedElems: List<any> = stabilizedThis.map(el => el[0])
|
||||||
|
|
||||||
return fixedElems.concat(sortedElems)
|
return fixedElems.concat(sortedElems)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ export type BalanceRow = SortRow<BalanceData>
|
||||||
export const getBalanceData = (activeTokens: List<Token>): List<BalanceRow> => {
|
export const getBalanceData = (activeTokens: List<Token>): List<BalanceRow> => {
|
||||||
const rows = activeTokens.map((token: Token) => ({
|
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 },
|
||||||
|
[buildOrderFieldFrom(BALANCE_TABLE_ASSET_ID)]: token.name,
|
||||||
[BALANCE_TABLE_BALANCE_ID]: `${token.balance} ${token.symbol}`,
|
[BALANCE_TABLE_BALANCE_ID]: `${token.balance} ${token.symbol}`,
|
||||||
[buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: Number(token.balance),
|
[buildOrderFieldFrom(BALANCE_TABLE_BALANCE_ID)]: Number(token.balance),
|
||||||
[FIXED]: token.get('symbol') === 'ETH',
|
[FIXED]: token.get('symbol') === 'ETH',
|
||||||
|
@ -34,7 +35,6 @@ export const generateColumns = () => {
|
||||||
label: 'Asset',
|
label: 'Asset',
|
||||||
custom: false,
|
custom: false,
|
||||||
width: 250,
|
width: 250,
|
||||||
sortKey: 'name',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const balanceColumn: Column = {
|
const balanceColumn: Column = {
|
||||||
|
|
Loading…
Reference in New Issue