extract `TableColumn` interface to a common place and use where necessary
This commit is contained in:
parent
1fb191b7ae
commit
5cb1eb483a
|
@ -4,6 +4,7 @@ import { List } from 'immutable'
|
|||
import { FIXED, buildOrderFieldFrom } from 'src/components/Table/sorting'
|
||||
import { formatAmount } from 'src/logic/tokens/utils/formatAmount'
|
||||
import { ETH_ADDRESS } from 'src/logic/tokens/utils/tokenHelpers'
|
||||
import { TableColumn } from 'src/routes/safe/components/tableTypes'
|
||||
|
||||
export const BALANCE_TABLE_ASSET_ID = 'asset'
|
||||
export const BALANCE_TABLE_BALANCE_ID = 'balance'
|
||||
|
@ -51,8 +52,8 @@ export const getBalanceData = (activeTokens, currencySelected, currencyValues, c
|
|||
return rows
|
||||
}
|
||||
|
||||
export const generateColumns = () => {
|
||||
const assetColumn = {
|
||||
export const generateColumns = (): List<TableColumn> => {
|
||||
const assetColumn: TableColumn = {
|
||||
id: BALANCE_TABLE_ASSET_ID,
|
||||
order: true,
|
||||
disablePadding: false,
|
||||
|
@ -61,7 +62,7 @@ export const generateColumns = () => {
|
|||
width: 250,
|
||||
}
|
||||
|
||||
const balanceColumn = {
|
||||
const balanceColumn: TableColumn = {
|
||||
id: BALANCE_TABLE_BALANCE_ID,
|
||||
align: 'right',
|
||||
order: true,
|
||||
|
@ -70,7 +71,7 @@ export const generateColumns = () => {
|
|||
custom: false,
|
||||
}
|
||||
|
||||
const actions = {
|
||||
const actions: TableColumn = {
|
||||
id: 'actions',
|
||||
order: false,
|
||||
disablePadding: false,
|
||||
|
@ -79,7 +80,7 @@ export const generateColumns = () => {
|
|||
static: true,
|
||||
}
|
||||
|
||||
const value = {
|
||||
const value: TableColumn = {
|
||||
id: BALANCE_TABLE_VALUE_ID,
|
||||
order: false,
|
||||
label: 'Value',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { List } from 'immutable'
|
||||
import { TableColumn } from 'src/routes/safe/components/tableTypes'
|
||||
|
||||
export const MODULES_TABLE_ADDRESS_ID = 'address'
|
||||
export const MODULES_TABLE_ACTIONS_ID = 'actions'
|
||||
|
@ -11,16 +12,6 @@ export const getModuleData = (
|
|||
}))
|
||||
}
|
||||
|
||||
interface TableColumn {
|
||||
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify'
|
||||
custom: boolean
|
||||
disablePadding: boolean
|
||||
id: string
|
||||
label: string
|
||||
order: boolean
|
||||
width?: number
|
||||
}
|
||||
|
||||
export const generateColumns = (): List<TableColumn> => {
|
||||
const addressColumn: TableColumn = {
|
||||
align: 'left',
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { List } from 'immutable'
|
||||
import { TableColumn } from 'src/routes/safe/components/tableTypes'
|
||||
|
||||
export const OWNERS_TABLE_NAME_ID = 'name'
|
||||
export const OWNERS_TABLE_ADDRESS_ID = 'address'
|
||||
|
@ -13,8 +14,8 @@ export const getOwnerData = (owners) => {
|
|||
return rows
|
||||
}
|
||||
|
||||
export const generateColumns = () => {
|
||||
const nameColumn = {
|
||||
export const generateColumns = (): List<TableColumn> => {
|
||||
const nameColumn: TableColumn = {
|
||||
id: OWNERS_TABLE_NAME_ID,
|
||||
order: false,
|
||||
disablePadding: false,
|
||||
|
@ -24,7 +25,7 @@ export const generateColumns = () => {
|
|||
align: 'left',
|
||||
}
|
||||
|
||||
const addressColumn = {
|
||||
const addressColumn: TableColumn = {
|
||||
id: OWNERS_TABLE_ADDRESS_ID,
|
||||
order: false,
|
||||
disablePadding: false,
|
||||
|
@ -33,7 +34,7 @@ export const generateColumns = () => {
|
|||
align: 'left',
|
||||
}
|
||||
|
||||
const actionsColumn = {
|
||||
const actionsColumn: TableColumn = {
|
||||
id: OWNERS_TABLE_ACTIONS_ID,
|
||||
order: false,
|
||||
disablePadding: false,
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
export interface TableColumn {
|
||||
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify'
|
||||
custom: boolean
|
||||
disablePadding: boolean
|
||||
id: string
|
||||
label: string
|
||||
order: boolean
|
||||
static?: boolean
|
||||
style?: any
|
||||
width?: number
|
||||
}
|
Loading…
Reference in New Issue