fix(#661): prices and number values right-aligned (#1193)

* fix: #661 prices and number values right-aligned

* fix: revert fills-table test created instead of date
This commit is contained in:
m.ray 2022-08-31 06:59:30 +01:00 committed by GitHub
parent fa6c4e7a02
commit 509a68d795
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 11 deletions

View File

@ -158,6 +158,7 @@ export const AccountsTable = forwardRef<AgGridReact, AccountsTableProps>(
headerName={t('Balance')} headerName={t('Balance')}
field="balance" field="balance"
cellRenderer="PriceCell" cellRenderer="PriceCell"
type="rightAligned"
valueFormatter={({ valueFormatter={({
value, value,
data, data,

View File

@ -18,6 +18,7 @@ import type {
FillFields_market_tradableInstrument_instrument_product, FillFields_market_tradableInstrument_instrument_product,
} from './__generated__/FillFields'; } from './__generated__/FillFields';
import type { Fills_party_tradesConnection_edges_node } from './__generated__/Fills'; import type { Fills_party_tradesConnection_edges_node } from './__generated__/Fills';
import classNames from 'classnames';
export type Props = (AgGridReactProps | AgReactUiProps) & { export type Props = (AgGridReactProps | AgReactUiProps) & {
partyId: string; partyId: string;
@ -44,15 +45,14 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
<AgGridColumn headerName={t('Market')} field="market.name" /> <AgGridColumn headerName={t('Market')} field="market.name" />
<AgGridColumn <AgGridColumn
headerName={t('Size')} headerName={t('Size')}
type="rightAligned"
field="size" field="size"
cellClass={({ data }: { data: FillFields }) => { cellClass={({ data }: { data: FillFields }) => {
let className = ''; return classNames('text-right', {
if (data?.buyer.id === partyId) { 'text-vega-green-dark dark:text-vega-green':
className = 'text-vega-green-dark dark:text-vega-green'; data?.buyer.id === partyId,
} else if (data?.seller.id) { 'text-vega-red-dark dark:text-vega-red': data?.seller.id,
className = 'text-vega-red-dark dark:text-vega-red'; });
}
return className;
}} }}
valueFormatter={formatSize(partyId)} valueFormatter={formatSize(partyId)}
/> />
@ -60,11 +60,13 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
headerName={t('Value')} headerName={t('Value')}
field="price" field="price"
valueFormatter={formatPrice} valueFormatter={formatPrice}
type="rightAligned"
/> />
<AgGridColumn <AgGridColumn
headerName={t('Filled value')} headerName={t('Filled value')}
field="price" field="price"
valueFormatter={formatTotal} valueFormatter={formatTotal}
type="rightAligned"
/> />
<AgGridColumn <AgGridColumn
headerName={t('Role')} headerName={t('Role')}
@ -75,6 +77,7 @@ export const FillsTable = forwardRef<AgGridReact, Props>(
headerName={t('Fee')} headerName={t('Fee')}
field="market.tradableInstrument.instrument.product" field="market.tradableInstrument.instrument.product"
valueFormatter={formatFee(partyId)} valueFormatter={formatFee(partyId)}
type="rightAligned"
/> />
<AgGridColumn <AgGridColumn
headerName={t('Date')} headerName={t('Date')}

View File

@ -122,7 +122,8 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
<AgGridColumn <AgGridColumn
headerName={t('Size')} headerName={t('Size')}
field="size" field="size"
cellClass="font-mono" cellClass="font-mono text-right"
type="rightAligned"
cellClassRules={{ cellClassRules={{
'text-vega-green-dark dark:text-vega-green': ({ 'text-vega-green-dark dark:text-vega-green': ({
data, data,
@ -185,7 +186,8 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
<AgGridColumn <AgGridColumn
headerName={t('Filled')} headerName={t('Filled')}
field="remaining" field="remaining"
cellClass="font-mono" cellClass="font-mono text-right"
type="rightAligned"
valueFormatter={({ valueFormatter={({
data, data,
value, value,
@ -207,7 +209,8 @@ export const OrderListTable = forwardRef<AgGridReact, OrderListTableProps>(
/> />
<AgGridColumn <AgGridColumn
field="price" field="price"
cellClass="font-mono" type="rightAligned"
cellClass="font-mono text-right"
valueFormatter={({ valueFormatter={({
value, value,
data, data,

View File

@ -34,7 +34,7 @@ const changeCellClass =
} }
} }
return ['font-mono', colorClass].join(' '); return ['font-mono text-right', colorClass].join(' ');
}; };
type Props = AgGridReactProps | AgReactUiProps; type Props = AgGridReactProps | AgReactUiProps;
@ -60,6 +60,7 @@ export const TradesTable = forwardRef<AgGridReact, Props>((props, ref) => {
<AgGridColumn <AgGridColumn
headerName={t('Price')} headerName={t('Price')}
field="price" field="price"
type="rightAligned"
width={130} width={130}
cellClass={changeCellClass('price')} cellClass={changeCellClass('price')}
valueFormatter={({ valueFormatter={({
@ -78,6 +79,7 @@ export const TradesTable = forwardRef<AgGridReact, Props>((props, ref) => {
headerName={t('Size')} headerName={t('Size')}
field="size" field="size"
width={125} width={125}
type="rightAligned"
valueFormatter={({ valueFormatter={({
value, value,
data, data,