Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(improvements) Invoices configuration getters #827

Merged
merged 28 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
02acd3f
Improve pub trades states handling
alexstotsky Jun 10, 2024
669cb18
Implement unified type formatter util
alexstotsky Jun 10, 2024
6223ae8
Optimize type foramtting in pub trades
alexstotsky Jun 10, 2024
12b2c88
Cleanup
alexstotsky Jun 10, 2024
db6f9f8
Rework and optimize public trades cols configs
alexstotsky Jun 10, 2024
aba2ea9
Cleanup
alexstotsky Jun 10, 2024
01a1fdc
Optimize cols getters
alexstotsky Jun 10, 2024
4f39ea4
Actualize getter import
alexstotsky Jun 10, 2024
65061bf
Lint fix
alexstotsky Jun 10, 2024
308e1b6
Improve pub funding states handling
alexstotsky Jun 11, 2024
63df8ab
Rework and optimize cell generation flow
alexstotsky Jun 11, 2024
3a15846
Improve getCols helper structure and cleanup
alexstotsky Jun 11, 2024
e7257cf
Actualize import
alexstotsky Jun 11, 2024
b3ece6e
Enhance derivative cols states handling
alexstotsky Jun 11, 2024
e82e89c
Rework and optimize derivatives cols configs
alexstotsky Jun 11, 2024
af757a9
Cleanup
alexstotsky Jun 11, 2024
5b8ed09
Improve invoices cell states handling
alexstotsky Jun 17, 2024
d6b2197
Rework and enhance invoices regular cells rendering
alexstotsky Jun 17, 2024
33103ed
Cleanup
alexstotsky Jun 17, 2024
9fbd1f7
Improve json formatter styling
alexstotsky Jun 18, 2024
860e6fc
Lint fix
alexstotsky Jun 18, 2024
055c75d
Adjust popup sizing
alexstotsky Jun 18, 2024
29c7dc1
Implement unified getJsonFormattedCell getter
alexstotsky Jun 18, 2024
618112b
Rework and optimize json formatted cell configs
alexstotsky Jun 18, 2024
f9e5ef6
Lint fix
alexstotsky Jun 18, 2024
debcb0a
Implement unified getLinkCell getter
alexstotsky Jun 18, 2024
6863f1e
Rework and optimize linked cell configs
alexstotsky Jun 18, 2024
7274a6f
Cleanup
alexstotsky Jun 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 19 additions & 101 deletions src/components/Derivatives/Derivatives.columns.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import React from 'react'
import { Cell } from '@blueprintjs/table'

import { formatAmount, fixedFloat } from 'ui/utils'
import { getCellState, getColumnWidth, getTooltipContent } from 'utils/columns'
import { getCell, getCellState, getColumnWidth } from 'utils/columns'

export const getColumns = ({
t,
Expand All @@ -19,15 +16,9 @@ export const getColumns = ({
className: 'align-left',
width: getColumnWidth('pair', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { pair } = filteredData[rowIndex]
return (
<Cell tooltip={getTooltipContent(pair, t)}>
{pair}
</Cell>
)
return getCell(pair, t)
},
copyText: rowIndex => filteredData[rowIndex].pair,
},
Expand All @@ -36,19 +27,9 @@ export const getColumns = ({
name: 'column.priceDeriv',
width: getColumnWidth('price', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { price } = filteredData[rowIndex]
const fixedPrice = fixedFloat(price)
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(fixedPrice, t)}
>
{fixedPrice}
</Cell>
)
return getCell(fixedFloat(price), t)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].price),
Expand All @@ -58,19 +39,9 @@ export const getColumns = ({
name: 'column.priceSpot',
width: getColumnWidth('priceSpot', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { priceSpot } = filteredData[rowIndex]
const fixedPrice = fixedFloat(priceSpot)
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(fixedPrice, t)}
>
{fixedPrice}
</Cell>
)
return getCell(fixedFloat(priceSpot), t)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].priceSpot),
Expand All @@ -80,19 +51,9 @@ export const getColumns = ({
name: 'column.fundBalance',
width: getColumnWidth('fundBal', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { fundBal } = filteredData[rowIndex]
const fixedBalance = fixedFloat(fundBal)
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(fixedBalance, t)}
>
{fixedBalance}
</Cell>
)
return getCell(fixedFloat(fundBal), t)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].fundBal),
Expand All @@ -102,19 +63,9 @@ export const getColumns = ({
name: 'column.fundingAccrued',
width: getColumnWidth('fundingAccrued', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { fundingAccrued } = filteredData[rowIndex]
const fixedFunding = fixedFloat(fundingAccrued)
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(fixedFunding, t)}
>
{formatAmount(fundingAccrued)}
</Cell>
)
return getCell(formatAmount(fundingAccrued), t, fixedFloat(fundingAccrued))
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].fundingAccrued),
Expand All @@ -124,18 +75,9 @@ export const getColumns = ({
name: 'column.fundingStep',
width: getColumnWidth('fundingStep', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { fundingStep } = filteredData[rowIndex]
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(fundingStep, t)}
>
{fundingStep}
</Cell>
)
return getCell(fundingStep, t)
},
copyText: rowIndex => filteredData[rowIndex].fundingStep,
},
Expand All @@ -145,15 +87,9 @@ export const getColumns = ({
nameStr: `${t('column.updated')} (${timeOffset})`,
width: getColumnWidth('timestamp', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const timestamp = getFullTime(filteredData[rowIndex].timestamp)
return (
<Cell tooltip={getTooltipContent(timestamp, t)}>
{timestamp}
</Cell>
)
return getCell(timestamp, t)
},
copyText: rowIndex => getFullTime(filteredData[rowIndex].timestamp),
},
Expand All @@ -162,18 +98,9 @@ export const getColumns = ({
name: 'column.clampMin',
width: getColumnWidth('clampMin', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { clampMin } = filteredData[rowIndex]
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(clampMin, t)}
>
{clampMin}
</Cell>
)
return getCell(clampMin, t)
},
copyText: rowIndex => filteredData[rowIndex].clampMin,
},
Expand All @@ -182,18 +109,9 @@ export const getColumns = ({
name: 'column.clampMax',
width: getColumnWidth('clampMax', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { clampMax } = filteredData[rowIndex]
return (
<Cell
className='bitfinex-text-align-right'
tooltip={getTooltipContent(clampMax, t)}
>
{clampMax}
</Cell>
)
return getCell(clampMax, t)
},
copyText: rowIndex => filteredData[rowIndex].clampMax,
},
Expand Down
Loading