Skip to content

Commit 110c2b2

Browse files
committed
chore: remove max ticks from contract card in open positions and contract details page
1 parent 4e066ec commit 110c2b2

File tree

6 files changed

+17
-26
lines changed

6 files changed

+17
-26
lines changed

packages/components/src/components/contract-card/contract-card-items/__tests__/tick-counter-bar.spec.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ describe('TickCounterBar', () => {
66
const mock_props = {
77
current_tick: 12345,
88
label: 'Ticks',
9-
max_ticks_duration: 67890,
109
};
1110
it('should render properly', () => {
1211
render(<TickCounterBar {...mock_props} />);
1312

14-
const ticks_info_el = screen.getByText('12345/67890 Ticks');
13+
const ticks_info_el = screen.getByText('12345 Ticks');
1514
expect(ticks_info_el).toHaveClass('dc-tick-counter-bar__text');
1615
});
1716
});

packages/components/src/components/contract-card/contract-card-items/contract-card-header.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,7 @@ const ContractCardHeader = ({
173173
) : null}
174174
</MobileWrapper>
175175
</div>
176-
{!is_sold && is_accumulator && (
177-
<TickCounterBar
178-
current_tick={tick_passed}
179-
max_ticks_duration={tick_count}
180-
label={getCardLabels().TICKS}
181-
/>
182-
)}
176+
{!is_sold && is_accumulator && <TickCounterBar current_tick={tick_passed} label={getCardLabels().TICKS} />}
183177
<MobileWrapper>
184178
<div className='dc-progress-slider--completed' />
185179
</MobileWrapper>

packages/components/src/components/contract-card/contract-card-items/tick-counter-bar.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import Text from '../../text';
44
type TTickCounterBar = {
55
current_tick?: number;
66
label: string;
7-
max_ticks_duration?: number;
87
};
9-
const TickCounterBar = ({ current_tick, label, max_ticks_duration }: TTickCounterBar) => (
8+
const TickCounterBar = ({ current_tick, label }: TTickCounterBar) => (
109
<div className='dc-tick-counter-bar__container'>
1110
<div className='dc-tick-counter-bar__track'>
1211
<Text size='xxs' weight='bold' align='center' color='profit-success' className='dc-tick-counter-bar__text'>
13-
{`${current_tick}/${max_ticks_duration} ${label}`}
12+
{`${current_tick} ${label}`}
1413
</Text>
1514
</div>
1615
</div>

packages/trader/src/AppV2/Components/ContractCard/__tests__/contract-card-status-timer.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ describe('ContractCardStatusTimer', () => {
2323
expect(screen.getByText('00:16:40')).toBeInTheDocument();
2424
});
2525
it('should render ticks progress if currentTick and tick_count are passed', () => {
26-
render(<ContractCardStatusTimer {...mockProps} currentTick={2} tick_count={10} />);
26+
render(<ContractCardStatusTimer {...mockProps} currentTick={2} />);
2727

28-
expect(screen.getByText('2/10 ticks')).toBeInTheDocument();
28+
expect(screen.getByText('2 ticks')).toBeInTheDocument();
2929
});
3030
it('should render Closed status if isSold === true', () => {
3131
render(<ContractCardStatusTimer {...mockProps} isSold />);

packages/trader/src/AppV2/Components/ContractCard/__tests__/contract-card.spec.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -389,12 +389,12 @@ describe('ContractCard', () => {
389389
expect(screen.getByText('Accumulators')).toBeInTheDocument();
390390
expect(screen.getByText(symbolName)).toBeInTheDocument();
391391
expect(screen.getByText('9.00 USD')).toBeInTheDocument();
392-
expect(screen.getByText('9/230 ticks')).toBeInTheDocument();
392+
expect(screen.getByText('9 ticks')).toBeInTheDocument();
393393
expect(screen.getByText('0.84 USD')).toBeInTheDocument();
394394
expect(screen.getByRole('button', { name: CLOSE })).toBeEnabled();
395395
expect(screen.queryByRole('button', { name: CANCEL })).not.toBeInTheDocument();
396396
});
397-
it('should show loader when a Close button is clicked and isSellRequested === true', () => {
397+
it('should show loader when a Close button is clicked and isSellRequested === true', async () => {
398398
const mockedOnClose = jest.fn();
399399
const { rerender } = render(
400400
mockedContractCard({
@@ -404,7 +404,7 @@ describe('ContractCard', () => {
404404
})
405405
);
406406
const closeButton = screen.getByRole('button', { name: getCardLabels().CLOSE });
407-
userEvent.click(closeButton);
407+
await userEvent.click(closeButton);
408408
expect(mockedOnClose).toHaveBeenCalledTimes(1);
409409

410410
rerender(
@@ -417,7 +417,7 @@ describe('ContractCard', () => {
417417
expect(screen.getByTestId(buttonLoaderId)).toBeInTheDocument();
418418
expect(closeButton).toBeDisabled();
419419
});
420-
it('should show loader when a Cancel button is clicked and isSellRequested === true', () => {
420+
it('should show loader when a Cancel button is clicked and isSellRequested === true', async () => {
421421
const mockedOnCancel = jest.fn();
422422
const { rerender } = render(
423423
mockedContractCard({
@@ -427,7 +427,7 @@ describe('ContractCard', () => {
427427
})
428428
);
429429
const cancelButton = screen.getByRole('button', { name: CANCEL });
430-
userEvent.click(cancelButton);
430+
await userEvent.click(cancelButton);
431431
expect(mockedOnCancel).toHaveBeenCalledTimes(1);
432432

433433
rerender(
@@ -452,7 +452,7 @@ describe('ContractCard', () => {
452452
expect(screen.queryByRole('button', { name: CLOSE })).not.toBeInTheDocument();
453453
expect(screen.queryByRole('button', { name: CANCEL })).not.toBeInTheDocument();
454454
});
455-
it('should call onClick when a card is clicked, and should redirect to a correct route if redirectTo is passed', () => {
455+
it('should call onClick when a card is clicked, and should redirect to a correct route if redirectTo is passed', async () => {
456456
const mockedOnClick = jest.fn();
457457
const redirectTo = getContractPath(Number(closedPositions[0].contract_info.contract_id));
458458
render(
@@ -464,11 +464,11 @@ describe('ContractCard', () => {
464464
})
465465
);
466466
const card = screen.getByText('Turbos Up');
467-
userEvent.click(card);
467+
await userEvent.click(card);
468468
expect(mockedOnClick).toHaveBeenCalledTimes(1);
469469
expect(history.location.pathname).toBe(redirectTo);
470470
});
471-
it('should call onClick when a card is clicked, but should not redirect anywhere if redirectTo prop is missing', () => {
471+
it('should call onClick when a card is clicked, but should not redirect anywhere if redirectTo prop is missing', async () => {
472472
const mockedOnClick = jest.fn();
473473
const redirectTo = getContractPath(Number(closedPositions[0].contract_info.contract_id));
474474
render(
@@ -479,7 +479,7 @@ describe('ContractCard', () => {
479479
})
480480
);
481481
const card = screen.getByText('Turbos Up');
482-
userEvent.click(card);
482+
await userEvent.click(card);
483483
expect(mockedOnClick).toHaveBeenCalledTimes(1);
484484
expect(history.location.pathname).not.toBe(redirectTo);
485485
});

packages/trader/src/AppV2/Components/ContractCard/contract-card-status-timer.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ export const ContractCardStatusTimer = ({
1717
date_expiry,
1818
isSold,
1919
serverTime,
20-
tick_count,
2120
}: TContractCardStatusTimerProps) => {
2221
const getDisplayedDuration = () => {
23-
if (tick_count) {
24-
return `${currentTick ?? 0}/${tick_count} ${getCardLabels().TICKS.toLowerCase()}`;
22+
if (currentTick) {
23+
return `${currentTick ?? 0} ${getCardLabels().TICKS.toLowerCase()}`;
2524
}
2625
if (date_expiry && serverTime) {
2726
return (

0 commit comments

Comments
 (0)