chore(trading): use action icon buttons (#4550)

This commit is contained in:
m.ray 2023-08-16 17:38:19 +03:00 committed by GitHub
parent 809f149df9
commit e3ed71bec4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -80,7 +80,7 @@ describe('OrderListTable', () => {
'-', '-',
Schema.OrderTimeInForceCode[marketOrder.timeInForce], Schema.OrderTimeInForceCode[marketOrder.timeInForce],
getDateTimeFormat().format(new Date(marketOrder.createdAt)), getDateTimeFormat().format(new Date(marketOrder.createdAt)),
'Edit', '',
]; ];
expectedValues.forEach((expectedValue, i) => expectedValues.forEach((expectedValue, i) =>
expect(cells[i]).toHaveTextContent(expectedValue) expect(cells[i]).toHaveTextContent(expectedValue)
@ -104,7 +104,7 @@ describe('OrderListTable', () => {
Schema.OrderTimeInForceCode[limitOrder.timeInForce] Schema.OrderTimeInForceCode[limitOrder.timeInForce]
}: ${getDateTimeFormat().format(new Date(limitOrder.expiresAt ?? ''))}`, }: ${getDateTimeFormat().format(new Date(limitOrder.expiresAt ?? ''))}`,
getDateTimeFormat().format(new Date(limitOrder.createdAt)), getDateTimeFormat().format(new Date(limitOrder.createdAt)),
'Edit', '',
]; ];
expectedValues.forEach((expectedValue, i) => expectedValues.forEach((expectedValue, i) =>
expect(cells[i]).toHaveTextContent(expectedValue) expect(cells[i]).toHaveTextContent(expectedValue)

View File

@ -271,8 +271,8 @@ export const OrderListTable = memo<
{ {
colId: 'amend', colId: 'amend',
...COL_DEFS.actions, ...COL_DEFS.actions,
minWidth: showAllActions ? 110 : COL_DEFS.actions.minWidth, minWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
maxWidth: showAllActions ? 110 : COL_DEFS.actions.minWidth, maxWidth: showAllActions ? 90 : COL_DEFS.actions.minWidth,
cellRenderer: ({ data }: { data?: Order }) => { cellRenderer: ({ data }: { data?: Order }) => {
if (!data) return null; if (!data) return null;
@ -285,14 +285,14 @@ export const OrderListTable = memo<
data-testid="edit" data-testid="edit"
onClick={() => onEdit(data)} onClick={() => onEdit(data)}
> >
{t('Edit')} <VegaIcon name={VegaIconNames.EDIT} size={16} />
</ButtonLink> </ButtonLink>
)} )}
<ButtonLink <ButtonLink
data-testid="cancel" data-testid="cancel"
onClick={() => onCancel(data)} onClick={() => onCancel(data)}
> >
{t('Cancel')} <VegaIcon name={VegaIconNames.CROSS} size={16} />
</ButtonLink> </ButtonLink>
</> </>
)} )}

View File

@ -211,7 +211,7 @@ describe('Positions', () => {
); );
}); });
const cells = screen.getAllByRole('gridcell'); const cells = screen.getAllByRole('gridcell');
expect(cells[11].textContent).toEqual('Close'); expect(cells[11].textContent).toEqual('');
}); });
it('do not display close button if openVolume is zero', async () => { it('do not display close button if openVolume is zero', async () => {

View File

@ -23,6 +23,8 @@ import {
TooltipCellComponent, TooltipCellComponent,
ExternalLink, ExternalLink,
Icon, Icon,
VegaIconNames,
VegaIcon,
} from '@vegaprotocol/ui-toolkit'; } from '@vegaprotocol/ui-toolkit';
import { import {
volumePrefix, volumePrefix,
@ -391,7 +393,7 @@ export const PositionsTable = ({
data-testid="close-position" data-testid="close-position"
onClick={() => data && onClose(data)} onClick={() => data && onClose(data)}
> >
{t('Close')} <VegaIcon name={VegaIconNames.CROSS} size={16} />
</ButtonLink> </ButtonLink>
) : null} ) : null}
{data?.assetId && ( {data?.assetId && (