From dc3a9f57c91e52ddefda95acc595fcf407522b20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Tue, 18 Jul 2023 13:16:07 +0200 Subject: [PATCH] feat(trading): copy order book volume value to deal ticket (#4333) --- apps/trading-e2e/src/integration/order-book.cy.ts | 6 ++++++ libs/market-depth/src/lib/orderbook-row.tsx | 9 ++++++++- libs/market-depth/src/lib/orderbook.tsx | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/apps/trading-e2e/src/integration/order-book.cy.ts b/apps/trading-e2e/src/integration/order-book.cy.ts index b93ddde6a..98ec1f513 100644 --- a/apps/trading-e2e/src/integration/order-book.cy.ts +++ b/apps/trading-e2e/src/integration/order-book.cy.ts @@ -81,6 +81,12 @@ describe('order book', { tags: '@smoke' }, () => { cy.getByTestId(dealTicketSize).should('have.value', '7'); }); + it('copy size to deal ticket form', () => { + // 6003-ORDB-009 + cy.getByTestId(bidVolume).click(); + cy.getByTestId(dealTicketSize).should('have.value', '1'); + }); + it('change price resolution', () => { // 6003-ORDB-008 const resolutions = [ diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx index 16aed132a..0767e2de2 100644 --- a/libs/market-depth/src/lib/orderbook-row.tsx +++ b/libs/market-depth/src/lib/orderbook-row.tsx @@ -120,8 +120,15 @@ export const OrderbookRow = React.memo( } /> {width >= HIDE_VOL_WIDTH && ( - + onClick && + value && + onClick({ + size: addDecimal(value, positionDecimalPlaces), + }) + } value={value} valueFormatted={addDecimalsFixedFormatNumber( value, diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index a6bcb42ac..e160a9c8b 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -1,4 +1,4 @@ -import { useCallback, useMemo, useRef, useState } from 'react'; +import { useMemo, useRef, useState } from 'react'; import ReactVirtualizedAutoSizer from 'react-virtualized-auto-sizer'; import { addDecimalsFormatNumber,