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) My history sections #844

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ebc4a64
Optimize movenents cell states handling
alexstotsky Aug 8, 2024
7f379cb
Unify standart cells renderers
alexstotsky Aug 8, 2024
438ff50
Implement unifued getFeeCell helper for better reusability
alexstotsky Aug 8, 2024
0606cef
Improve movements fees column configuration
alexstotsky Aug 8, 2024
8fe302b
Lint fix
alexstotsky Aug 8, 2024
0d274d3
Actualize column utils export
alexstotsky Aug 8, 2024
b45dd69
Improve tooltip handling for unified fees cell formatter
alexstotsky Aug 9, 2024
ec1c724
Actualized getter params providing
alexstotsky Aug 9, 2024
374c111
Optimize trades cell states handling
alexstotsky Aug 9, 2024
200c7dd
Actualize trades getter import
alexstotsky Aug 9, 2024
bb89598
Improve col getter structure
alexstotsky Aug 9, 2024
ecd4e15
Rework and optimize trades cells config getters
alexstotsky Aug 9, 2024
f86a9c0
Lint fix & cleanup
alexstotsky Aug 9, 2024
f04dd91
Optimize fees tooltip content providing
alexstotsky Aug 9, 2024
9a53eff
Minor tweaks
alexstotsky Aug 9, 2024
8c59e6b
Improve orders cells state handling
alexstotsky Aug 12, 2024
2f7ec92
Rework and optimize regular orders cells confgigs
alexstotsky Aug 12, 2024
4e191e1
Improve orders meta cell generation flow
alexstotsky Aug 12, 2024
b8c401d
Lint fix and cleanup
alexstotsky Aug 12, 2024
0c77e74
Actualize column getters import
alexstotsky Aug 12, 2024
1544fb5
Imprpove positions sections cell states handling
alexstotsky Aug 12, 2024
63df722
Improve positions active cells configs
alexstotsky Aug 12, 2024
f62eda2
Optimize collateral meta col getters
alexstotsky Aug 12, 2024
074b9ab
Rework and optimize positions cells gneneration flow
alexstotsky Aug 12, 2024
c95e254
Implemented unified getActionCell utility
alexstotsky Aug 13, 2024
7a5d6fa
Optimize movements more info col getter
alexstotsky Aug 13, 2024
ae243a1
Fix action cell content providing
alexstotsky Aug 13, 2024
3d8f39e
Add action cell value providing
alexstotsky Aug 13, 2024
f3164fb
Enhance pos id generation flow, cleanup
alexstotsky Aug 13, 2024
f007dc1
Rework and optimize orders id column getter
alexstotsky Aug 13, 2024
15f3209
Cleanup
alexstotsky Aug 13, 2024
2b07f8f
Lint fix
alexstotsky Aug 15, 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
138 changes: 29 additions & 109 deletions src/components/Movements/Movements.columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,14 @@ import { Cell } from '@blueprintjs/table'

import config from 'config'
import Explorer from 'ui/Explorer'
import {
getCell,
getFeeCell,
getCellState,
getActionCell,
getColumnWidth,
} from 'utils/columns'
import { prepareCurrency } from 'state/symbols/utils'
import { getCellState, getColumnWidth } from 'utils/columns'
import { formatAmount, fixedFloat, insertIf } from 'ui/utils'

const getColumns = ({
Expand All @@ -24,22 +30,10 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('moreDetails', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { id } = filteredData[rowIndex]
return (
<Cell tooltip={t('column.moreDetails')}>
<>
<a
href='#'
onClick={e => onDetailsClick(e, { id })}
>
{t('column.show')}
</a>
</>
</Cell>
)
const cellAction = (e) => onDetailsClick(e, { id })
return getActionCell(t('column.show'), cellAction, t, t('column.moreDetails'))
},
copyText: rowIndex => filteredData[rowIndex].id,
}] : []),
Expand All @@ -49,15 +43,9 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('id', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { id } = filteredData[rowIndex]
return (
<Cell tooltip={id}>
{id}
</Cell>
)
return getCell(id, t)
},
copyText: rowIndex => filteredData[rowIndex].id,
},
Expand All @@ -67,15 +55,9 @@ const getColumns = ({
nameStr: `${t('column.date')} (${timeOffset})`,
width: getColumnWidth('mtsUpdated', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const timestamp = getFullTime(filteredData[rowIndex].mtsUpdated)
return (
<Cell tooltip={timestamp}>
{timestamp}
</Cell>
)
return getCell(timestamp, t)
},
copyText: rowIndex => getFullTime(filteredData[rowIndex].mtsUpdated),
},
Expand All @@ -85,16 +67,10 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('currency', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { currency, currencyName } = filteredData[rowIndex]
const preparedCurrency = prepareCurrency(currency, currencyName, tetherNames)
return (
<Cell tooltip={preparedCurrency}>
{preparedCurrency}
</Cell>
)
return getCell(preparedCurrency, t)
},
copyText: rowIndex => filteredData[rowIndex].currency,
},
Expand All @@ -104,15 +80,9 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('status', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { status } = filteredData[rowIndex]
return (
<Cell tooltip={status}>
{status}
</Cell>
)
return getCell(status, t)
},
copyText: rowIndex => filteredData[rowIndex].status,
},
Expand All @@ -121,19 +91,9 @@ const getColumns = ({
name: 'column.amount',
width: getColumnWidth('amount', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { amount, currency } = filteredData[rowIndex]
const tooltip = `${fixedFloat(amount)} ${currency}`
return (
<Cell
className='bitfinex-text-align-right'
tooltip={tooltip}
>
{formatAmount(amount)}
</Cell>
)
return getCell(formatAmount(amount), t, `${fixedFloat(amount)} ${currency}`)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].amount),
Expand All @@ -144,19 +104,9 @@ const getColumns = ({
name: 'column.amountUsd',
width: getColumnWidth('amountUsd', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { amountUsd } = filteredData[rowIndex]
const tooltip = `${fixedFloat(amountUsd)} ${t('column.usd')}`
return (
<Cell
className='bitfinex-text-align-right'
tooltip={tooltip}
>
{formatAmount(amountUsd)}
</Cell>
)
return getCell(formatAmount(amountUsd), t, `${fixedFloat(amountUsd)} ${t('column.usd')}`)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].amountUsd),
Expand All @@ -167,25 +117,9 @@ const getColumns = ({
name: 'column.fees',
width: getColumnWidth('fees', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { fees, currency } = filteredData[rowIndex]
const tooltip = `${fixedFloat(fees)} ${currency}`
return (
<Cell
className='bitfinex-text-align-right'
tooltip={tooltip}
>
<>
{formatAmount(fees)}
{' '}
<span className='bitfinex-show-soft'>
{currency}
</span>
</>
</Cell>
)
return getFeeCell(fees, currency, t, `${fixedFloat(fees)} ${currency}`)
},
isNumericValue: true,
copyText: rowIndex => fixedFloat(filteredData[rowIndex].fees),
Expand All @@ -196,9 +130,7 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('destinationAddress', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { currency, destinationAddress } = filteredData[rowIndex]
return (
<Cell tooltip={destinationAddress}>
Expand All @@ -218,15 +150,9 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('transactionId', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { transactionId } = filteredData[rowIndex]
return (
<Cell tooltip={transactionId}>
{transactionId}
</Cell>
)
return getCell(transactionId, t)
},
copyText: rowIndex => filteredData[rowIndex].transactionId,
},
Expand All @@ -236,15 +162,9 @@ const getColumns = ({
className: 'align-left',
width: getColumnWidth('note', columnsWidth),
renderer: (rowIndex) => {
if (isLoading || isNoData) {
return getCellState(isLoading, isNoData)
}
if (isLoading || isNoData) return getCellState(isLoading, isNoData)
const { note } = filteredData[rowIndex]
return (
<Cell tooltip={note}>
{note}
</Cell>
)
return getCell(note, t)
},
copyText: rowIndex => filteredData[rowIndex].note,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/OrderTrades/OrderTrades.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { getMappedSymbolsFromUrl } from 'state/symbols/utils'
import { SectionHeader, SectionHeaderTitle } from 'ui/SectionHeader'

import OrderTradesNoData from './OrderTrades.NoData'
import getColumns from '../Trades/Trades.columns'
import { getColumns } from '../Trades/Trades.columns'

const { MENU_ORDER_TRADES } = queryConstants

Expand Down
Loading