Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

fiona / Change margin to CFDs #1841

Merged
merged 46 commits into from
Jul 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
71ddee0
add markets available for CFD trading
Jun 15, 2021
9e02ed5
add start trading CFDs on deriv section
Jun 15, 2021
8349fdc
add styling for cfd page sections
Jun 16, 2021
c588c13
add more CFDs page sections
Jun 16, 2021
5d933c0
add cfd page
Jun 16, 2021
f445598
change margin to cfd
Jun 17, 2021
cc78b5e
update margin to cfds
Jun 17, 2021
9a06d4c
minify svg file
Jun 18, 2021
4df4237
fix: missing s and currencies
Jun 23, 2021
91137ae
triger deployment
Jun 23, 2021
70f9936
trigger deployment
Jun 23, 2021
71be709
update margin-calculator link
Jun 24, 2021
948bbc5
fix: spacing on title
Jun 24, 2021
e17e70d
align checklist icon with titles in responsive mode
Jun 25, 2021
b3caa1e
remove real Deriv X
Jun 25, 2021
398daf4
update text
Jun 28, 2021
53afadf
remove extra space
Jun 28, 2021
1501d78
change margin and swap calculator
Jun 29, 2021
193ec64
implement pr changes
Jun 29, 2021
6fc3c1a
delete fragment
Jun 29, 2021
e06090b
add redirect to cfds page
Jun 29, 2021
85683c3
redirect margin to cfds
Jun 29, 2021
854afc1
add markets available for CFD trading
Jun 15, 2021
2361b78
add start trading CFDs on deriv section
Jun 15, 2021
a2e50ca
add styling for cfd page sections
Jun 16, 2021
9c7a873
add more CFDs page sections
Jun 16, 2021
7920bea
add cfd page
Jun 16, 2021
6708f31
change margin to cfd
Jun 17, 2021
9c23013
update margin to cfds
Jun 17, 2021
d616656
minify svg file
Jun 18, 2021
438b5e7
fix: missing s and currencies
Jun 23, 2021
680bedb
update margin-calculator link
Jun 24, 2021
e4d617c
fix: spacing on title
Jun 24, 2021
3aff213
align checklist icon with titles in responsive mode
Jun 25, 2021
3a7e8e9
remove real Deriv X
Jun 25, 2021
5f17f70
update text
Jun 28, 2021
2ce156e
remove extra space
Jun 28, 2021
eba370c
change margin and swap calculator
Jun 29, 2021
c7e888d
implement pr changes
Jun 29, 2021
4e2c33f
delete fragment
Jun 29, 2021
c8fa78d
add redirect to cfds page
Jun 29, 2021
7914c13
redirect margin to cfds
Jun 29, 2021
bb08c2f
remove unused import
Jul 9, 2021
e942dc5
resolve conflicts
Jul 9, 2021
4824bde
resolve conflicts
Jul 9, 2021
290b665
delete margin folder
Jul 9, 2021
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
31 changes: 31 additions & 0 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ exports.onCreatePage = ({ page, actions }) => {
const is_p2p = /responsible/g.test(page.path)
const is_story = /story/g.test(page.path)
const is_market = /markets/g.test(page.path)
const is_cfds = /cfds/g.test(page.path)

if (is_responsible_trading) {
createRedirect({
Expand Down Expand Up @@ -97,6 +98,21 @@ exports.onCreatePage = ({ page, actions }) => {
})
}

if (is_cfds) {
createRedirect({
fromPath: `/trade-types/margin/`,
toPath: `/trade-types/cfds/`,
redirectInBrowser: true,
isPermanent: true,
})
createRedirect({
fromPath: `/trade-types/margin`,
toPath: `/trade-types/cfds/`,
redirectInBrowser: true,
isPermanent: true,
})
}

Object.keys(language_config).map((lang) => {
// Use the values defined in "locales" to construct the path
const { path, is_default } = language_config[lang]
Expand Down Expand Up @@ -232,6 +248,21 @@ exports.onCreatePage = ({ page, actions }) => {
})
}

if (is_cfds) {
createRedirect({
fromPath: `/${lang}/trade-types/margin/`,
toPath: `/${lang}/trade-types/cfds/`,
redirectInBrowser: true,
isPermanent: true,
})
createRedirect({
fromPath: `/${lang}/trade-types/margin`,
toPath: `/${lang}/trade-types/cfds/`,
redirectInBrowser: true,
isPermanent: true,
})
}

return current_page
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/custom/_dtrading.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const DTrading = ({ trading, reverse, two_title }) => {
const data = useStaticQuery(query)
return (
<StyledSection>
<Container direction='column'>
<Container direction="column">
{trading.map((item, index) => {
let is_even = reverse ? (index + 1) % 2 : index % 2
return (
Expand Down
14 changes: 7 additions & 7 deletions src/components/custom/other-platforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import DTrader from 'images/svg/dtrader-icon.svg'
import Forex from 'images/svg/forex-nav.svg'
import Help from 'images/svg/menu/help-center.svg'
import Leadership from 'images/svg/menu/leadership.svg'
import Margin from 'images/svg/margin-trading-nav.svg'
import CFD from 'images/svg/margin-trading-nav.svg'
Copy link
Contributor

Choose a reason for hiding this comment

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

The image name and Variable name is not similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Omitted this since I was resolving the same in the image house-keeping task

import Multipliers from 'images/svg/multipliers-nav.svg'
import Options from 'images/svg/options-nav.svg'
import Partner from 'images/svg/menu/partner.svg'
Expand Down Expand Up @@ -269,14 +269,14 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => {
<Flex direction="column" wrap="wrap" jc="flex-start">
<StyledText>{localize('Trade types')}</StyledText>
<NavCard
aria_label="Margin trading"
icon={() => <img src={Margin} alt="Margin" width="32" height="32" />}
aria_label="CFDs"
icon={() => <img src={CFD} alt="CFDs" width="32" height="32" />}
content={
<Localize translate_text="Trade with leverage and low spreads for better returns on successful trades." />
<Localize translate_text="Trade with leverage and tight spreads for better returns on successful trades." />
}
title={<Localize translate_text="Margin trading" />}
title={<Localize translate_text="CFDs" />}
onClick={onClick}
to="/trade-types/margin/"
to="/trade-types/cfds/"
/>
{!is_eu_country && (
<NavCard
Expand All @@ -298,7 +298,7 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => {
<img src={Multipliers} alt="Multipliers" width="32" height="32" />
)}
content={
<Localize translate_text="Combine the upside of margin trading with the simplicity of options." />
<Localize translate_text="Combine the upside of CFDs with the simplicity of options." />
}
title={<Localize translate_text="Multipliers" />}
onClick={onClick}
Expand Down
19 changes: 7 additions & 12 deletions src/components/elements/off-canvas-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import DTrader from 'images/svg/dtrader-icon.svg'
import Forex from 'images/svg/forex-nav.svg'
import Help from 'images/svg/menu/help-center.svg'
import Leadership from 'images/svg/menu/leadership.svg'
import MarginTrading from 'images/svg/margin-trading-nav.svg'
import CFD from 'images/svg/margin-trading-nav.svg'
Copy link
Contributor

Choose a reason for hiding this comment

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

The image name and Variable name is not similar.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as here...

import Multipliers from 'images/svg/multipliers-nav.svg'
import Options from 'images/svg/options-nav.svg'
import Partner from 'images/svg/menu/partner.svg'
Expand Down Expand Up @@ -151,21 +151,16 @@ export const OffCanvasMenuWrapper = (props) => {
</Text>
<Flex mb="2rem">
<NavCard
aria_label="Margin trading"
aria_label="CFDs"
icon={() => (
<img
src={MarginTrading}
alt="MarginTrading"
width="32"
height="32"
/>
<img src={CFD} alt="CFDs" width="32" height="32" />
)}
content={
<Localize translate_text="Trade with leverage and low spreads for better returns on successful trades." />
<Localize translate_text="Trade with leverage and tight spreads for better returns on successful trades." />
}
title={<Localize translate_text="Margin trading" />}
title={<Localize translate_text="CFDs" />}
onClick={handleArrowClick}
to="/trade-types/margin/"
to="/trade-types/cfds/"
/>
</Flex>
{!is_eu_country && (
Expand Down Expand Up @@ -201,7 +196,7 @@ export const OffCanvasMenuWrapper = (props) => {
/>
)}
content={
<Localize translate_text="Combine the upside of margin trading with the simplicity of options." />
<Localize translate_text="Combine the upside of CFDs with the simplicity of options." />
}
title={<Localize translate_text="Multipliers" />}
onClick={handleArrowClick}
Expand Down
57 changes: 16 additions & 41 deletions src/components/layout/footer/main-links.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import React from 'react'
import PropTypes from 'prop-types'
import {LinksWrapper, LinkWrapper, LinksCol, Title, Link } from './common/style.js'
import { LinksWrapper, LinkWrapper, LinksCol, Title, Link } from './common/style.js'
import { localize } from 'components/localization'
import { Flex, Show } from 'components/containers'
import {
deriv_status_page_url,
} from 'common/constants'

const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
import { deriv_status_page_url } from 'common/constants'

const MainLinksSection = ({ is_ppc, is_ppc_redirect, is_eu_country }) => {
return (
<LinksWrapper>
<Show.Desktop>
Expand All @@ -24,14 +21,10 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
<Link to="/leadership/">{localize('Our leadership')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/why-choose-us/">
{localize('Why choose us?')}
</Link>
<Link to="/why-choose-us/">{localize('Why choose us?')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/partners/">
{localize('Partnership programmes')}
</Link>
<Link to="/partners/">{localize('Partnership programmes')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/contact_us/">{localize('Contact us')}</Link>
Expand Down Expand Up @@ -78,21 +71,15 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
<Title>{localize('TRADE TYPES')}</Title>
</LinkWrapper>
<LinkWrapper first_child="true">
<Link to="/trade-types/margin/">
{localize('Margin trading')}
</Link>
<Link to="/trade-types/cfds/">{localize('CFDs')}</Link>
</LinkWrapper>
<Show.NonEU>
<LinkWrapper>
<Link to="/trade-types/options/">
{localize('Options')}
</Link>
<Link to="/trade-types/options/">{localize('Options')}</Link>
</LinkWrapper>
</Show.NonEU>
<LinkWrapper>
<Link to="/trade-types/multiplier/">
{localize('Multipliers')}
</Link>
<Link to="/trade-types/multiplier/">{localize('Multipliers')}</Link>
</LinkWrapper>
</LinksCol>
)}
Expand All @@ -111,24 +98,18 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
</LinkWrapper>
)}
<LinkWrapper>
<Link to="/markets/stock/">
{localize('Stocks & indices')}
</Link>
<Link to="/markets/stock/">{localize('Stocks & indices')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/markets/commodities/">
{localize('Commodities')}
</Link>
<Link to="/markets/commodities/">{localize('Commodities')}</Link>
</LinkWrapper>
</LinksCol>
<LinksCol>
<LinkWrapper>
<Title>{localize('LEGAL')}</Title>
</LinkWrapper>
<LinkWrapper first_child="true">
<Link to="/regulatory">
{localize('Regulatory information')}
</Link>
<Link to="/regulatory">{localize('Regulatory information')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/terms-and-conditions">
Expand All @@ -151,9 +132,7 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/partners/payment-agent/">
{localize('Payment agents')}
</Link>
<Link to="/partners/payment-agent/">{localize('Payment agents')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link
Expand Down Expand Up @@ -186,14 +165,10 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/trader-tools/">
{localize('Traders’ tools')}
</Link>
<Link to="/trader-tools/">{localize('Traders’ tools')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link to="/payment-methods/">
{localize('Payment methods')}
</Link>
<Link to="/payment-methods/">{localize('Payment methods')}</Link>
</LinkWrapper>
<LinkWrapper>
<Link
Expand Down Expand Up @@ -223,11 +198,11 @@ const MainLinksSection = ({is_ppc, is_ppc_redirect, is_eu_country }) => {
)
}

export default MainLinksSection;
export default MainLinksSection

MainLinksSection.propTypes = {
is_eu_country: PropTypes.bool,
is_ppc: PropTypes.bool,
is_ppc_redirect: PropTypes.bool,
type: PropTypes.string,
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/images/common/multiplier/[email protected]
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/common/trade-types/cfd-pattern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/images/svg/trade-types/cryptocurrencies.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/pages/dmt5/_margin_calculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,13 @@ const MarginCalculator = () => {
</MainHeader>
<StyledText>
<Localize
translate_text="Explore <0>margin trading</0> on DMT5, and enjoy high leverage and low spreads to increase your returns when the market moves in your favour."
translate_text="Explore <0>CFDs</0> on Deriv MT5, and enjoy high leverage and low spreads to increase your returns when the market moves in your favour."
components={[
<LinkText
color="red"
key={0}
target="_blank"
href="/trade-types/margin/"
href="/trade-types/cfds/"
rel="noopener noreferrer"
/>,
]}
Expand Down
18 changes: 9 additions & 9 deletions src/pages/home/_trade-types-mobile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Carousel, Header, Text } from 'components/elements'
import { SectionContainer, Flex } from 'components/containers'
import { localize, Localize, LocalizedLink } from 'components/localization'
import { LinkButton } from 'components/form'
import MarginLogo from 'images/svg/trade-types/margin.svg'
import CFDLogo from 'images/svg/trade-types/cfds.svg'
import OptionsLogo from 'images/svg/trade-types/options.svg'
import MultipliersLogo from 'images/svg/trade-types/multipliers.svg'
import Arrow from 'images/svg/arrow-right.svg'
Expand Down Expand Up @@ -87,14 +87,14 @@ TradeTypeSlide.propTypes = {
}

const TradeTypesMobile = () => {
const margin = {
icon: <img src={MarginLogo} alt="margin" width="48" height="49" />,
title: <Localize translate_text="Margin trading" />,
const cfds = {
icon: <img src={CFDLogo} alt="cfd" width="48" height="49" />,
title: <Localize translate_text="CFDs" />,
description: (
<Localize translate_text="Trade with leverage and low spreads for better returns on successful trades." />
<Localize translate_text="Trade with leverage and tight spreads for better returns on successful trades." />
),
link: '/trade-types/margin/',
linkTitle: localize('Margin'),
link: '/trade-types/cfds/',
linkTitle: localize('CFD'),
}
const options = {
icon: <img src={OptionsLogo} alt="options" width="48" height="49" />,
Expand All @@ -109,15 +109,15 @@ const TradeTypesMobile = () => {
icon: <img src={MultipliersLogo} alt="multipliers" width="48" height="49" />,
title: <Localize translate_text="Multipliers" />,
description: (
<Localize translate_text="Get the best of both - the upside of margin trading with the simplicity of options." />
<Localize translate_text="Get the best of both - the upside of CFDs with the simplicity of options." />
),
link: '/trade-types/multiplier/',
linkTitle: localize('Multiplier'),
}

const { is_eu_country } = React.useContext(DerivStore)

const trade_types = is_eu_country ? [margin, multipliers] : [margin, options, multipliers]
const trade_types = is_eu_country ? [cfds, multipliers] : [cfds, options, multipliers]

const settings = {
options: {
Expand Down
Loading