Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arshad/Matin/WALL-1226/Dynamic leverage for MT5 financial accounts #9314

Merged
merged 37 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1666f28
chore: Dynamic leverage for MT5 financial accounts initial commit
matin-deriv Jul 11, 2023
ca108e4
Merge branch 'master' into dynamic_leverage
matin-deriv Jul 11, 2023
f20c73e
feat: :construction: dynamic leverage modal
arshad-rao-deriv Jul 20, 2023
a78f050
test: unit tests
arshad-rao-deriv Jul 20, 2023
80f93b9
feat: :white_check_mark: added unit tests and refactoring
arshad-rao-deriv Jul 24, 2023
72d908c
feat: :recycle: fixed UI
arshad-rao-deriv Jul 25, 2023
a37bb26
Merge pull request #380 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Jul 26, 2023
b355297
feat: :recycle: review changes for dynamic leverage
arshad-rao-deriv Jul 26, 2023
9c6cc4b
Merge remote-tracking branch 'origin/master' into Arshad/CFDS-637/Dyn…
arshad-rao-deriv Jul 26, 2023
9260071
chore: item name update
matin-deriv Jul 27, 2023
903c9ff
Merge remote-tracking branch 'matin/dynamic_leverage' into Arshad/CFD…
arshad-rao-deriv Jul 27, 2023
f735fa4
Merge pull request #391 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Jul 27, 2023
501ebb5
feat: :bug: passed string to localize instead of a variable
arshad-rao-deriv Jul 28, 2023
6638c27
Merge pull request #392 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Jul 31, 2023
ed91257
Merge remote-tracking branch 'origin/master' into Arshad/CFDS-637/Dyn…
arshad-rao-deriv Aug 3, 2023
75c179e
Merge pull request #394 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 3, 2023
ba5bb3b
test: :recycle:
arshad-rao-deriv Aug 4, 2023
d55099f
refactor: :recycle: refactored column header to new component
arshad-rao-deriv Aug 7, 2023
7e8f17e
Merge pull request #395 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 7, 2023
14cb8e5
refactor: refactored code
arshad-rao-deriv Aug 7, 2023
90736d9
fix: fixed styling and refactored code
arshad-rao-deriv Aug 8, 2023
79b0b25
Merge pull request #396 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 9, 2023
2d3c185
style: formatted code
arshad-rao-deriv Aug 9, 2023
b4cb5f5
test: updated test mock component
arshad-rao-deriv Aug 9, 2023
09952ae
Merge pull request #397 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 9, 2023
9f695ae
Merge remote-tracking branch 'origin/master' into Arshad/CFDS-637/Dyn…
arshad-rao-deriv Aug 11, 2023
3796834
Merge pull request #398 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
mahdiyeh-deriv Aug 11, 2023
031d054
refactor: refactored styling and unit tests
arshad-rao-deriv Aug 13, 2023
7c318d0
Merge pull request #399 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 15, 2023
e50d382
fix: fixed text content for dynamic leverage
arshad-rao-deriv Aug 21, 2023
e411b57
fix: fixed localize component usage
arshad-rao-deriv Aug 22, 2023
e85dd14
refactor: used strong instead of span styling
arshad-rao-deriv Aug 22, 2023
f0795c2
Merge pull request #400 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 22, 2023
7e1e26c
fix: jurisdiction card layout
arshad-rao-deriv Aug 22, 2023
55a1107
Merge pull request #401 from arshad-rao-deriv/Arshad/CFDS-637/Dynamic…
matin-deriv Aug 23, 2023
004d8be
Merge remote-tracking branch 'origin/master' into Arshad/DynamicLeverage
arshad-rao-deriv Sep 1, 2023
d021ad3
Merge pull request #402 from arshad-rao-deriv/Arshad/DynamicLeverage
matin-deriv Sep 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 128 additions & 0 deletions packages/appstore/src/components/cfds-listing/cfds-listing.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
.jurisdiction-modal {
&__title {
display: flex;
gap: 1.6rem;
align-items: center;
margin: 0 1rem;

&-back {
display: flex;
align-items: center;
cursor: pointer;
}
}
&__content-wrapper {
display: flex;
flex-direction: column;
@include desktop {
overflow: auto;
}
width: 100%;
position: absolute;
backface-visibility: hidden;
transition: transform 0.6s ease;
transform: rotateY(0deg);
}
&__scrollable-content {
@include desktop {
Expand All @@ -26,6 +43,38 @@
bottom: 0;
}
}

&__wrapper {
height: 76rem;
perspective: 100rem;
overflow: scroll;

@include mobile {
height: calc(100vh - 4rem);
}
}

&__flipped {
@include desktop {
height: 70rem;
}

.jurisdiction-modal {
&__scrollable-content {
height: 80rem;
}

&__content-wrapper {
height: 70rem;
transform: rotateY(-180deg);
visibility: hidden;
}
}

.dynamic-leverage-modal {
transform: rotateY(0deg);
}
}
}

.cfd-jurisdiction-card--synthetic,
Expand Down Expand Up @@ -678,6 +727,85 @@
}
}

.dynamic-leverage-modal {
display: flex;
flex-direction: column;
gap: 2.4rem;
margin: 1.5rem 12.8rem 10rem;
position: absolute;
matin-deriv marked this conversation as resolved.
Show resolved Hide resolved
backface-visibility: hidden;
transition: transform 0.6s ease;
transform: rotateY(180deg);

@include mobile {
margin: 1.5rem 2.4rem 2.4rem;
}

&__content {
display: grid;
gap: 2.4rem;
grid-template-columns: 1fr 1fr;
margin: 0 10rem;

@include mobile {
grid-template-columns: 1fr;
margin: 0 6.5rem;
}
}

&__market {
border: 0.5px solid var(--border-hover);
border-radius: $BORDER_RADIUS * 2;
overflow: hidden;
background-color: var(--general-hover);
height: 24.8rem;

&-description {
font-style: italic;
}

&-table {
padding-bottom: 1rem;

&-header {
display: flex;
flex-direction: column;
}

&-row {
grid-template-columns: 1fr 0.5fr 1.25fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
}

&-header-row {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    &-header {
        &-row {

@arshad-rao-deriv nit-pick: please nest -row class inside -header :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arshad-rao-deriv could you please also put :nth-child(even) and :nth-child(odd) inside -row too 🙏🏻? to make use of sass nesting :) like this:

&-row {
// styles for -row
    &:nth-child(even) {
    // styles for -row:nth-child(even)
    }
    &:nth-child(odd) {
    // styles for -row:nth-child(odd)
    }
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

grid-template-columns: 1fr 0.5fr 1.25fr;
justify-items: center;
border-bottom: 0;
padding: 0.4rem 0;
background-color: var(--general-hover);
}

&-row:nth-child(even) {
background-color: var(--general-hover);
}

&-row:nth-child(odd) {
background-color: var(--general-section-1);
}
}

&-title {
display: flex;
flex-direction: column;
height: 7rem;
padding-top: 1rem;
background-color: var(--general-section-1);
}
}
}

.cfd-financial-stp-modal {
display: flex;
height: 100%;
Expand Down
22 changes: 9 additions & 13 deletions packages/appstore/src/modules/onboarding/onboarding.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { localize } from '@deriv/translations';
import { isMobile, isDesktop, routes, ContentFlag } from '@deriv/shared';
import { Button, Text, Icon, ProgressBarOnboarding } from '@deriv/components';
import TradigPlatformIconProps from 'Assets/svgs/trading-platform';
import { Button, Text, Icon, ProgressBarTracker } from '@deriv/components';
import TradingPlatformIconProps from 'Assets/svgs/trading-platform';
import { getTradingHubContents } from 'Constants/trading-hub-content';
import { useHistory } from 'react-router-dom';
import { observer } from 'mobx-react-lite';
Expand All @@ -26,7 +26,7 @@ type TOnboardingProps = {

const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) => {
const history = useHistory();
const number_of_steps = Object.keys(contents);
const steps_list = Object.keys(contents);
const { traders_hub, client } = useStores();
const { toggleIsTourOpen, selectAccountType, is_demo_low_risk, content_flag } = traders_hub;
const { is_eu_country, is_logged_in, is_landing_company_loaded, prev_account_type, setPrevAccountType } = client;
Expand All @@ -37,8 +37,8 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
};

const nextStep = () => {
if (step < number_of_steps.length) setStep(step + 1);
if (step === number_of_steps.length) {
if (step < steps_list.length) setStep(step + 1);
if (step === steps_list.length) {
toggleIsTourOpen(true);
history.push(routes.traders_hub);
if (is_demo_low_risk) {
Expand All @@ -60,7 +60,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
content_flag === ContentFlag.EU_DEMO;

const is_eu_user = (is_logged_in && eu_user) || (!is_logged_in && is_eu_country);
const onboarding_step = number_of_steps[step - 1];
const onboarding_step = steps_list[step - 1];

const footer_header = contents[onboarding_step]?.footer_header;
const footer_text = contents[onboarding_step]?.footer_text;
Expand All @@ -80,7 +80,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
<div className='onboarding-wrapper'>
<div className='onboarding-header'>
<div className='onboarding-header--deriv-logo'>
<TradigPlatformIconProps icon={'DerivLogo'} />
<TradingPlatformIconProps icon={'DerivLogo'} />
</div>
<Icon
icon='IcCross'
Expand All @@ -105,7 +105,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
<Button secondary onClick={prevStep} style={step === 1 ? { visibility: 'hidden' } : {}}>
{localize('Back')}
</Button>
<ProgressBarOnboarding step={step} amount_of_steps={number_of_steps} setStep={setStep} />
<ProgressBarTracker step={step} steps_list={steps_list} setStep={setStep} />
<Button primary onClick={nextStep} className='onboarding-footer-buttons--full-size'>
{contents[onboarding_step]?.has_next_content
? contents[onboarding_step]?.next_content
Expand All @@ -116,11 +116,7 @@ const Onboarding = ({ contents = getTradingHubContents() }: TOnboardingProps) =>
{isMobile() && (
<React.Fragment>
<div className='onboarding-footer__progress-bar'>
<ProgressBarOnboarding
step={step}
amount_of_steps={number_of_steps}
setStep={setStep}
/>
<ProgressBarTracker step={step} steps_list={steps_list} setStep={setStep} />
</div>
<div
className='onboarding-footer-buttons'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { Toast } from '@deriv/components';
import { localize } from '@deriv/translations';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';

const BotNotification = observer(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { observer } from 'mobx-react';
import { Button } from '@deriv/components';
import { localize } from '@deriv/translations';
import './index.scss';
import { observer } from 'mobx-react';
import { useDBotStore } from 'Stores/useDBotStore';
import './index.scss';

const RecentFooter = observer(() => {
const { load_modal } = useDBotStore();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import classNames from 'classnames';
import { Icon, ProgressBarOnboarding, Text } from '@deriv/components';
import { Icon, ProgressBarTracker, Text } from '@deriv/components';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';
Expand Down Expand Up @@ -181,9 +181,9 @@ const TourSlider = observer(() => {
<div className='dbot-slider__status'>
<div className='dbot-slider__progress-bar'>
{(!has_started_onboarding_tour || (has_started_onboarding_tour && step !== 1)) && (
<ProgressBarOnboarding
<ProgressBarTracker
step={step}
amount_of_steps={Object.keys(
steps_list={Object.keys(
!has_started_onboarding_tour ? BOT_BUILDER_MOBILE : DBOT_ONBOARDING_MOBILE
)}
setStep={setStep}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { Text, Accordion } from '@deriv/components';
import { Accordion, Text } from '@deriv/components';
import { isMobile } from '@deriv/shared';
import { localize } from '@deriv/translations';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';
import { TDescription } from './tutorial-content';

Expand Down
2 changes: 1 addition & 1 deletion packages/bot-web-ui/src/components/download/download.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Button, Icon, Popover } from '@deriv/components';
import { localize } from '@deriv/translations';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';

type TDownloadProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Button } from '@deriv/components';
import { localize } from '@deriv/translations';
import { observer } from '@deriv/stores';
import { localize } from '@deriv/translations';
import { useDBotStore } from 'Stores/useDBotStore';

const RecentFooter = observer(() => {
Expand Down
5 changes: 5 additions & 0 deletions packages/cfd/src/Components/props.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export type TCardFlipStatus = {
export type TClickableDescription = {
type: 'text' | 'link';
text: string;
onClick?: React.MouseEventHandler<HTMLSpanElement>;
};

export type TJurisdictionCardSectionTitleIndicators = {
Expand Down Expand Up @@ -131,6 +132,10 @@ export type TJurisdictionCardItems = {
financial_verification_docs?: TJurisdictionCardItemVerification;
};

export type TJurisdictionCardParams = {
toggleDynamicLeverage: React.MouseEventHandler<HTMLSpanElement>;
};

export type TJurisdictionVerificationSection = {
icon: string;
text: string;
Expand Down
Loading