forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[DTRA] Maryia/DTRA-1471/feat: [V2] Implement Growth rate trade param …
…functionality + Accumulator trade features updates (deriv-com#16365) * feat: add bottom sheet to Growth rate trade param * feat: initial - add wheel picker for growth rate * chore: styles + close action sheet upon saving growth rate * chore: finalize wheel picker styles * feat: make proposal request when the wheel stops turning * test: GrowthRate * feat: remove Max ticks from AccumulatorsInformation * feat: update purchase button (buy & close) for accu * fix: make disabled purchase buttons non-transparent + growth rate feature style and tests fixes
- Loading branch information
1 parent
abf00f3
commit a01a34d
Showing
25 changed files
with
594 additions
and
115 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...rader/src/AppV2/Components/TradeParamDefinition/__tests__/trade-param-definition.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import TradeParamDefinition from '../trade-param-definition'; | ||
|
||
describe('TradeParamDefinition', () => { | ||
it('should not render if description is not passed', () => { | ||
const { container } = render(<TradeParamDefinition />); | ||
|
||
expect(container).toBeEmptyDOMElement(); | ||
}); | ||
|
||
it('should render description that is provided', () => { | ||
render(<TradeParamDefinition description='test description' />); | ||
|
||
expect(screen.getByText('test description')).toBeInTheDocument(); | ||
}); | ||
}); |
4 changes: 4 additions & 0 deletions
4
packages/trader/src/AppV2/Components/TradeParamDefinition/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import './trade-param-definition.scss'; | ||
import TradeParamDefinition from './trade-param-definition'; | ||
|
||
export default TradeParamDefinition; |
7 changes: 7 additions & 0 deletions
7
packages/trader/src/AppV2/Components/TradeParamDefinition/trade-param-definition.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
$HANDLEBAR_HEIGHT: var(--core-size-1000); | ||
$HEADER_TITLE_HEIGHT: var(--core-size-3200); | ||
|
||
.trade-param-definition { | ||
height: calc(400px - $HANDLEBAR_HEIGHT - $HEADER_TITLE_HEIGHT); | ||
padding-block-start: 0; | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/trader/src/AppV2/Components/TradeParamDefinition/trade-param-definition.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import { ActionSheet, Text } from '@deriv-com/quill-ui'; | ||
|
||
type TTradeParamDefinitionProps = { | ||
description?: React.ReactNode; | ||
}; | ||
|
||
const TradeParamDefinition = ({ description }: TTradeParamDefinitionProps) => { | ||
if (!description) return null; | ||
return ( | ||
<ActionSheet.Content className='trade-param-definition'> | ||
<Text>{description}</Text> | ||
</ActionSheet.Content> | ||
); | ||
}; | ||
|
||
export default TradeParamDefinition; |
44 changes: 44 additions & 0 deletions
44
...nents/TradeParameters/AccumulatorsInformation/__tests__/accumulators-information.spec.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
import { mockStore } from '@deriv/stores'; | ||
import AccumulatorsInformation from '../accumulators-information'; | ||
import ModulesProvider from 'Stores/Providers/modules-providers'; | ||
import TraderProviders from '../../../../../trader-providers'; | ||
|
||
describe('AccumulatorsInformation', () => { | ||
let default_mock_store: ReturnType<typeof mockStore>; | ||
|
||
beforeEach( | ||
() => | ||
(default_mock_store = mockStore({ | ||
modules: { | ||
trade: { | ||
...mockStore({}), | ||
currency: 'USD', | ||
maximum_payout: 4000, | ||
}, | ||
}, | ||
})) | ||
); | ||
|
||
const mockAccumulatorsInformation = (props?: React.ComponentProps<typeof AccumulatorsInformation>) => | ||
render( | ||
<TraderProviders store={default_mock_store}> | ||
<ModulesProvider store={default_mock_store}> | ||
<AccumulatorsInformation {...props} /> | ||
</ModulesProvider> | ||
</TraderProviders> | ||
); | ||
it('should not render if description is not passed', () => { | ||
const { container } = mockAccumulatorsInformation({ is_minimized: true }); | ||
|
||
expect(container).toBeEmptyDOMElement(); | ||
}); | ||
|
||
it('should render description that is provided', () => { | ||
mockAccumulatorsInformation(); | ||
|
||
expect(screen.getByText('Max. payout')).toBeInTheDocument(); | ||
expect(screen.getByText('4,000.00 USD')).toBeInTheDocument(); | ||
}); | ||
}); |
3 changes: 0 additions & 3 deletions
3
...rc/AppV2/Components/TradeParameters/AccumulatorsInformation/accumulators-information.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.