diff --git a/src/common/constants.ts b/src/common/constants.ts index 216df5df4d7..5e6ec07b1a7 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -12,6 +12,9 @@ const domain_url = ? window.location.hostname : deriv_com_url +export const eu_domains = ['eu', 'staging-eu'] +export const uk_domains = ['uk', 'staging-uk'] + // URL export const domain_full_url = `https://${domain_url}` export const deriv_app_id = domain_url === deriv_com_url ? deriv_com_app_id : deriv_me_app_id diff --git a/src/components/containers/visibility.tsx b/src/components/containers/visibility.tsx index 618dac01a5f..b3e2e1be0d6 100644 --- a/src/components/containers/visibility.tsx +++ b/src/components/containers/visibility.tsx @@ -1,8 +1,9 @@ -import React, { ReactElement, useEffect, useState } from 'react' +import React, { ReactElement, useEffect, useState, useContext } from 'react' import styled from 'styled-components' import { size } from 'themes/device' import { useBrowserResize } from 'components/hooks/use-browser-resize' import { DerivStore } from 'store' +import { eu_domains, uk_domains } from 'common/constants' type ResponsiveContainerProps = { children: ReactElement @@ -25,6 +26,7 @@ const DesktopLayer = styled.div` display: none; } ` + const MobileLayer = styled.div` @media (min-width: ${({ breakpoint }) => breakpoint}px) { display: none; @@ -37,11 +39,12 @@ const domainBasedCheck = () => { useEffect(() => { if (window) { - const host_name = window.location.hostname - if (host_name.includes('eu')) { + const subdomain = window.location.hostname.split('.').slice(0, -2).join('.') + + if (eu_domains.includes(subdomain)) { setEuDomain(true) } - if (host_name.includes('uk')) { + if (uk_domains.includes(subdomain)) { setUkDomain(true) } } @@ -64,6 +67,20 @@ const deviceRenderer = (): boolean => { return is_loaded } +export const getCountryRule = () => { + const { is_eu_domain, is_uk_domain } = domainBasedCheck() + const { is_eu_country, is_uk_country } = useContext(DerivStore) + + const is_eu = (is_eu_country || is_eu_domain) && !is_uk_country + const is_uk = is_uk_country || is_uk_domain + const is_non_uk = !is_uk + const is_non_eu = !is_eu + const is_eu_uk = !(!is_eu && !is_uk) + const is_row = !is_eu_uk + + return { is_eu, is_uk, is_non_uk, is_non_eu, is_eu_uk, is_row } +} + export const Desktop = ({ children, breakpoint = DEFAULT_BREAKPOINT, @@ -96,47 +113,37 @@ export const Mobile = ({ children, breakpoint = DEFAULT_BREAKPOINT }: Responsive } export const EU = ({ children }: ResponsiveContainerProps) => { - const { is_eu_domain } = domainBasedCheck() - const { is_eu_country } = React.useContext(DerivStore) - - const is_eu = is_eu_country || is_eu_domain + const { is_eu } = getCountryRule() return is_eu ? <>{children} : null } export const NonEU = ({ children }: ResponsiveContainerProps) => { - const { is_eu_domain } = domainBasedCheck() - const { is_eu_country } = React.useContext(DerivStore) + const { is_non_eu } = getCountryRule() - const is_eu = is_eu_domain || is_eu_country - - return !is_eu ? <>{children} : null + return is_non_eu ? <>{children} : null } export const UK = ({ children }: ResponsiveContainerProps) => { - const { is_uk_domain } = domainBasedCheck() - const { is_uk_country } = React.useContext(DerivStore) - - const is_uk = is_uk_country || is_uk_domain + const { is_uk } = getCountryRule() return is_uk ? <>{children} : null } export const NonUK = ({ children }: ResponsiveContainerProps) => { - const { is_uk_domain } = domainBasedCheck() - const { is_uk_country } = React.useContext(DerivStore) + const { is_non_uk } = getCountryRule() - const is_uk = is_uk_domain || is_uk_country + return is_non_uk ? <>{children} : null +} - return !is_uk ? <>{children} : null +export const UKEU = ({ children }: ResponsiveContainerProps) => { + const { is_eu_uk } = getCountryRule() + + return is_eu_uk ? <>{children} : null } export const ROW = ({ children }: ResponsiveContainerProps) => { - const { is_uk_domain, is_eu_domain } = domainBasedCheck() - const { is_uk_country, is_eu_country } = React.useContext(DerivStore) - - const is_uk = is_uk_country || is_uk_domain - const is_eu = is_eu_domain || is_eu_country + const { is_row } = getCountryRule() - return !is_eu && !is_uk ? <>{children} : null + return is_row ? <>{children} : null } diff --git a/src/components/custom/_signup-public.js b/src/components/custom/_signup-public.js index dc8914f0c7c..fb3899d9567 100644 --- a/src/components/custom/_signup-public.js +++ b/src/components/custom/_signup-public.js @@ -10,9 +10,9 @@ import { Flex, Show, Box, Container } from 'components/containers' import { deriv_app_url } from 'common/constants' import device from 'themes/device.js' // SVG -import Apple from 'images/svg/custom/apple.svg' -import Facebook from 'images/svg/custom/facebook-blue.svg' -import Google from 'images/svg/custom/google.svg' +import Apple from 'images/svg/custom/apple-40.svg' +import Facebook from 'images/svg/custom/facebook-40.svg' +import Google from 'images/svg/custom/google-40.svg' import Arrow from 'images/svg/custom/chevron-right.svg' const query = graphql` @@ -155,57 +155,15 @@ const MobileSocialWrapper = styled(SocialWrapper)` } ` const SocialButton = styled(Button)` - width: 110px; - line-height: 27px; - padding: 5px; - border-radius: 4px; - justify-content: center; display: flex; - background-color: var(--color-white); - border: solid 1px var(--color-grey-7); - height: 4rem; - margin: 0 0.8rem; + padding: 0; + margin: 0 1rem; + border: none; - &:nth-of-type(1) { - margin-left: 0; - } - img { - padding-right: 5px; - object-fit: contain; - } @media ${device.tabletL} { - width: 114px; - height: 48px; - padding: 0; justify-content: center; - align-items: center; - - img { - margin-top: 12px; - width: 30px; - } - } - @media (max-width: 500px) { - width: 100%; - height: 40px; - padding: 0; - line-height: 14px; - - img { - margin-top: 3px; - padding-right: 0; - } } ` -const SocialButtonText = styled.div` - display: flex; - - span { - display: block; - width: 100%; - } -` - const StyledHeader = styled(Header)` width: ${(props) => props.width || '41.4rem'}; position: ${(props) => props.position || 'static'}; @@ -420,10 +378,7 @@ const SignupPublic = ({ type="button" social > - - google - Google - + google - - facebook - Facebook - + facebook - - apple - Apple - + apple @@ -579,14 +523,7 @@ const SignupPublic = ({ type="button" social > - - google - + google - - facebook - + facebook - - apple - + apple diff --git a/src/components/custom/other-platforms.js b/src/components/custom/other-platforms.js index 1a287bac015..58a6b3e7dad 100644 --- a/src/components/custom/other-platforms.js +++ b/src/components/custom/other-platforms.js @@ -1,7 +1,15 @@ import React from 'react' import PropTypes from 'prop-types' import styled, { css } from 'styled-components' -import { SectionContainer, Flex, FlexGridContainer, EU, NonEU } from 'components/containers' +import { + SectionContainer, + Flex, + FlexGridContainer, + EU, + NonEU, + NonUK, + ROW, +} from 'components/containers' import { Text, Card, @@ -283,7 +291,7 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => { onClick={onClick} to="/trade-types/cfds/" /> - + } @@ -294,7 +302,7 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => { onClick={onClick} to="/trade-types/options/" /> - + } @@ -321,7 +329,7 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => { onClick={onClick} to={is_ppc_redirect ? '/landing/dmt5/' : '/dmt5/'} /> - + <> { otherLinkProps={{ rel: 'noopener noreferrer' }} /> - + @@ -362,7 +370,7 @@ export const NavPlatform = ({ onClick, is_ppc, is_ppc_redirect }) => { onClick={onClick} to="/dtrader/" /> - + <> { otherLinkProps={{ rel: 'noopener noreferrer' }} /> - + ) @@ -410,62 +418,68 @@ NavPlatform.propTypes = { onClick: PropTypes.func, } -export const NavMarket = ({ onClick, is_ppc }) => ( - - } - content={ - - } - title={} - onClick={onClick} - to="/markets/forex/" - /> - {!is_ppc && ( +export const NavMarket = ({ onClick, is_ppc }) => { + return ( + } + aria_label="Forex" + icon={() => } content={ - + } - title={} + title={} onClick={onClick} - to="/markets/synthetic/" + to="/markets/forex/" /> - )} - } - content={ - - } - title={} - onClick={onClick} - to="/markets/stock/" - /> - } - content={ - - } - title={} - onClick={onClick} - to="/markets/cryptocurrencies/" - /> - } - content={ - - } - title={} - onClick={onClick} - to="/markets/commodities/" - /> - -) + + {!is_ppc && ( + } + content={ + + } + title={} + onClick={onClick} + to="/markets/synthetic/" + /> + )} + + } + content={ + + } + title={} + onClick={onClick} + to="/markets/stock/" + /> + + } + content={ + + } + title={} + onClick={onClick} + to="/markets/cryptocurrencies/" + /> + + } + content={ + + } + title={} + onClick={onClick} + to="/markets/commodities/" + /> + + ) +} NavMarket.propTypes = { is_ppc: PropTypes.bool, diff --git a/src/components/elements/off-canvas-menu.js b/src/components/elements/off-canvas-menu.js index 5545ac1c564..30d55b0dd15 100644 --- a/src/components/elements/off-canvas-menu.js +++ b/src/components/elements/off-canvas-menu.js @@ -2,7 +2,7 @@ import React, { useState, useRef, useEffect } from 'react' import styled from 'styled-components' import PropTypes from 'prop-types' import { useOutsideClick } from 'components/hooks/use-outside-click' -import { Flex, NonEU } from 'components/containers' +import { Flex, ROW, NonUK } from 'components/containers' import { LocalizedLink, localize, Localize } from 'components/localization' import { Accordion, AccordionItem, NavCard, Text, Divider } from 'components/elements' import { deriv_status_page_url } from 'common/constants' @@ -156,7 +156,7 @@ export const OffCanvasMenuWrapper = (props) => { to="/trade-types/cfds/" /> - + { to="/trade-types/options/" /> - + { to={props.is_ppc_redirect ? '/landing/dmt5/' : '/dmt5/'} /> - + { to="/derivx/" /> - + { to="/dtrader/" /> - + <> { /> - + { to="/markets/forex/" /> - {!props.is_ppc && ( - - ( - - )} - content={localize( - 'Enjoy synthetic markets that emulate real-world market movements.', - )} - title={localize('Synthetic indices')} - onClick={handleArrowClick} - to="/markets/synthetic/" - /> - - )} + + {!props.is_ppc && ( + + ( + + )} + content={localize( + 'Enjoy synthetic markets that emulate real-world market movements.', + )} + title={localize('Synthetic indices')} + onClick={handleArrowClick} + to="/markets/synthetic/" + /> + + )} + { to="/markets/stock/" /> - - ( - - )} - content={localize( - 'Trade with leverage on the price movement of popular crypto-fiat pairs.', - )} - title={localize('Cryptocurrencies')} - onClick={handleArrowClick} - to="/markets/cryptocurrencies/" - /> - + + + ( + + )} + content={localize( + 'Trade with leverage on the price movement of popular crypto-fiat pairs.', + )} + title={localize('Cryptocurrencies')} + onClick={handleArrowClick} + to="/markets/cryptocurrencies/" + /> + + { @@ -12,7 +12,7 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { - Codestin Search App + Codestin Search App {localize('Who we are')} @@ -30,66 +30,21 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { {localize('Careers')} - - - Codestin Search App - - - {localize('DTrader')} - - - - {localize('Deriv GO')} - - - {localize('DBot')} - - - - - {localize('DMT5')} - - - - - {localize('Deriv X')} - - - - {localize('SmartTrader')} - - - - - {localize('Binary Bot')} - - - - {!is_ppc && ( - Codestin Search App + Codestin Search App {localize('CFDs')} - + - {localize('Options')} + + {localize('Digital options')} + - + {localize('Multipliers')} @@ -102,24 +57,28 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { {localize('Forex')} - {!is_ppc && ( - - - {localize('Synthetic indices')} - - - )} + + {!is_ppc && ( + + + {localize('Synthetic indices')} + + + )} + {localize('Stocks & indices')} + + + + {localize('Cryptocurrencies')} + + + {localize('Commodities')} - - - {localize('Cryptocurrencies')} - - @@ -130,10 +89,18 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { {localize('Deriv MT5')} + + + {localize('DerivX')} + + + {localize('Deriv GO')} + + {localize('DTrader')} - + { {localize('DBot')} - - - {localize('Binary Bot')} - - - + + + + {localize('Binary Bot')} + + + + @@ -191,20 +160,15 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { {localize('Payment agents')} - - {localize('API')} - + {localize('Developers')} + + + {localize('Bug bounty')} - Codestin Search App + Codestin Search App {localize('Help centre')} @@ -220,9 +184,6 @@ const MainLinksSection = ({ is_ppc, is_ppc_redirect }) => { {localize('Community')} - - {localize('Traders’ tools')} - {localize('Payment methods')} diff --git a/src/images/svg/custom/apple-40.svg b/src/images/svg/custom/apple-40.svg new file mode 100644 index 00000000000..bf70546a590 --- /dev/null +++ b/src/images/svg/custom/apple-40.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/images/svg/custom/facebook-40.svg b/src/images/svg/custom/facebook-40.svg new file mode 100644 index 00000000000..65b214b79d8 --- /dev/null +++ b/src/images/svg/custom/facebook-40.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/images/svg/custom/google-40.svg b/src/images/svg/custom/google-40.svg new file mode 100644 index 00000000000..1af9ed57286 --- /dev/null +++ b/src/images/svg/custom/google-40.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/pages/home/_hero.tsx b/src/pages/home/_hero.tsx index fd99385637b..ba3490a2fc0 100644 --- a/src/pages/home/_hero.tsx +++ b/src/pages/home/_hero.tsx @@ -9,6 +9,7 @@ import { LinkButton } from 'components/form' import { Container, Box, Flex } from 'components/containers' import { BackgroundImage, Header } from 'components/elements' import { Localize, localize } from 'components/localization' +import { getCountryRule } from 'components/containers/visibility' const query = graphql` query { @@ -74,10 +75,14 @@ const StyledHeader = styled(Header)` const Hero = ({ is_ppc }: HeroProps) => { const data = useStaticQuery(query) + const { is_uk } = getCountryRule() - const text = !is_ppc - ? localize('Trade forex, synthetics, stocks & indices, cryptocurrencies, and commodities.') - : localize('Trade forex, commodities, stocks, and stock indices') + const text = + !is_ppc && !is_uk + ? localize( + 'Trade forex, synthetics, stocks & indices, cryptocurrencies, and commodities.', + ) + : localize('Trade forex, stocks & indices, and commodities.') return ( diff --git a/src/pages/home/_markets_fold.tsx b/src/pages/home/_markets_fold.tsx index e16f37efceb..0df2305a081 100644 --- a/src/pages/home/_markets_fold.tsx +++ b/src/pages/home/_markets_fold.tsx @@ -7,7 +7,7 @@ import { LocalizedLink, Localize } from 'components/localization' import { Carousel, Header, QueryImage, Text } from 'components/elements' import { useBrowserResize } from 'components/hooks/use-browser-resize' import device from 'themes/device.js' -import { Desktop, Mobile } from 'components/containers/visibility' +import { getCountryRule, Desktop, Mobile } from 'components/containers/visibility' const FoldWrapper = styled(SectionContainer)` max-width: 100%; @@ -127,6 +127,39 @@ const market_data = [ }, ] +const market_data_uk = [ + { + header: , + description: ( + + ), + img_name: 'market_forex', + to: '/markets/forex/', + gradient_start: '#661B20', + gradient_end: '#190708', + }, + { + header: , + description: ( + + ), + img_name: 'market_stocks_indices', + to: '/markets/stock/', + gradient_start: '#2A2040', + gradient_end: '#0A0810', + }, + { + header: , + description: ( + + ), + img_name: 'market_commodities', + to: '/markets/commodities/', + gradient_start: '#183046', + gradient_end: '#060C11', + }, +] + const query = graphql` query { market_forex: file(relativePath: { eq: "home/market_forex.png" }) { @@ -221,6 +254,7 @@ const CarouselItem = ({ const MarketsFold = () => { const data = useStaticQuery(query) + const { is_uk } = getCountryRule() const [is_mobile] = useBrowserResize() const [is_not_big_screen] = useBrowserResize(1979) const settings = { @@ -262,13 +296,13 @@ const MarketsFold = () => { autoplay_interval={is_mobile ? 3200 : 4000} {...settings} > - {market_data.map((market) => { + {(is_uk ? market_data_uk : market_data).map((market, index) => { const { header, description, img_name, gradient_start, gradient_end, to } = market return ( { + const { is_row } = getCountryRule() + return ( { align="center" mobileM={{ max_width: '328px' }} > - {localize( - 'Choose from 8 powerful platforms — each designed with your needs in mind', - )} + diff --git a/src/pages/home/_platform-slideshow.tsx b/src/pages/home/_platform-slideshow.tsx index 66e5db7b4dc..cf8b466d8b3 100644 --- a/src/pages/home/_platform-slideshow.tsx +++ b/src/pages/home/_platform-slideshow.tsx @@ -5,6 +5,7 @@ import styled from 'styled-components' import { Flex } from 'components/containers' import QueryImage from 'components/elements/query-image' import device from 'themes/device' +import { getCountryRule } from 'components/containers/visibility' const query = graphql` query { @@ -53,13 +54,19 @@ const StyledImage = styled(QueryImage)<{ $is_hidden: boolean }>` const PlatformSlideshow = () => { const [active_index, setActiveIndex] = useState(0) const data = useStaticQuery(query) + const { is_row } = getCountryRule() - const slide_images = [ - { key: 'hero1', image: data.hero_platform1 }, - { key: 'hero2', image: data.hero_platform2 }, - { key: 'hero3', image: data.hero_platform3 }, - { key: 'hero4', image: data.hero_platform4 }, - ] + const slide_images = is_row + ? [ + { key: 'hero1', image: data.hero_platform1 }, + { key: 'hero2', image: data.hero_platform2 }, + { key: 'hero3', image: data.hero_platform3 }, + { key: 'hero4', image: data.hero_platform4 }, + ] + : [ + { key: 'hero2', image: data.hero_platform2 }, + { key: 'hero3', image: data.hero_platform3 }, + ] const setNextImage = useCallback(() => { setActiveIndex((prevIndex) => (prevIndex >= slide_images.length - 1 ? 0 : prevIndex + 1)) @@ -71,7 +78,7 @@ const PlatformSlideshow = () => { }, 5000) return () => clearInterval(slideshow_timer) - }, []) + }, [slide_images]) return ( diff --git a/src/pages/home/_trade-types.tsx b/src/pages/home/_trade-types.tsx index fd85e26a3a7..493df4405dc 100644 --- a/src/pages/home/_trade-types.tsx +++ b/src/pages/home/_trade-types.tsx @@ -7,6 +7,7 @@ import { Flex, SectionContainer } from 'components/containers' import { useBrowserResize } from 'components/hooks/use-browser-resize' import device from 'themes/device.js' import Arrow from 'images/svg/trade-types/arrow-right.svg' +import { getCountryRule } from 'components/containers/visibility' type TradeTypesProps = { image_url: string @@ -40,7 +41,7 @@ const query = graphql` } ` -const ItemsDetails: TradeTypesProps[] = [ +const items_details_cr: TradeTypesProps[] = [ { image_url: 'trade_type_cfds', image_alt: , @@ -55,7 +56,9 @@ const ItemsDetails: TradeTypesProps[] = [ image_url: 'trade_type_multipliers', image_alt: , header: , - desc: , + desc: ( + + ), link: '/trade-types/multiplier/', link_text: , }, @@ -69,6 +72,29 @@ const ItemsDetails: TradeTypesProps[] = [ }, ] +const items_details_eu_uk: TradeTypesProps[] = [ + { + image_url: 'trade_type_cfds', + image_alt: , + header: , + desc: ( + + ), + link: '/trade-types/cfds/', + link_text: , + }, + { + image_url: 'trade_type_multipliers', + image_alt: , + header: , + desc: ( + + ), + link: '/trade-types/multiplier/', + link_text: , + }, +] + const StyledSection = styled(SectionContainer)` max-width: 100%; @@ -211,6 +237,8 @@ const TradeItems = ({ items_details }: TradeItemsProps): ReactElement => { } const TradeTypes = (): React.ReactNode => { + const { is_row } = getCountryRule() + const items_details_by_region = is_row ? items_details_cr : items_details_eu_uk const [is_not_big_screen] = useBrowserResize(1979) const settings = { options: { @@ -249,13 +277,16 @@ const TradeTypes = (): React.ReactNode => { mb="40px" tablet={{ mb: '16px' }} > - {localize('Trade the way you want with 3 exciting trade types')} + - {ItemsDetails.map((item) => { + {items_details_by_region.map((item) => { return ( @@ -267,7 +298,7 @@ const TradeTypes = (): React.ReactNode => { - {ItemsDetails.map((item) => { + {items_details_by_region.map((item) => { return ( diff --git a/src/pages/home/platform-carousel/_desktop-platform-carousel.tsx b/src/pages/home/platform-carousel/_desktop-platform-carousel.tsx index 31672d14a8c..8191297f5f3 100644 --- a/src/pages/home/platform-carousel/_desktop-platform-carousel.tsx +++ b/src/pages/home/platform-carousel/_desktop-platform-carousel.tsx @@ -14,7 +14,7 @@ const StyledDesktopCarousel = styled(Flex)` ` const DesktopPlatformCarousel = () => { const [slide_index, setSlideIndex] = useState(getSlideStartingIndex()) - const platform_details = getPlatformDetails(no_slide_sets) + const platform_details = getPlatformDetails(no_slide_sets()) return ( diff --git a/src/pages/home/platform-carousel/_mobile-platform-carousel.tsx b/src/pages/home/platform-carousel/_mobile-platform-carousel.tsx index c63d213387f..0d3b5fb5927 100644 --- a/src/pages/home/platform-carousel/_mobile-platform-carousel.tsx +++ b/src/pages/home/platform-carousel/_mobile-platform-carousel.tsx @@ -1,11 +1,18 @@ import React from 'react' import { graphql, useStaticQuery } from 'gatsby' import styled, { css } from 'styled-components' -import { platform_details, getOSIcon, PlatformContent, ImageTag } from './_utils' +import { + platform_details_cr, + platform_details_eu_uk, + getOSIcon, + PlatformContent, + ImageTag, +} from './_utils' import type { PlatformDetailsProps } from './_utils' import device from 'themes/device.js' import { Flex } from 'components/containers' import { Carousel, QueryImage, StyledLink } from 'components/elements' +import { getCountryRule } from 'components/containers/visibility' const CarouselItemWrapper = styled.div` width: 100%; @@ -120,15 +127,16 @@ const PlatformDetails = ({ title, icon, description, learn_more_link }: Platform } const MobilePlatformCarousel = () => { + const { is_row } = getCountryRule() const images = useStaticQuery(image_query) return ( - {platform_details.map((platform, index) => { + {(is_row ? platform_details_cr : platform_details_eu_uk).map((platform, index) => { const image_key = Object.keys(images)[index] return ( - + diff --git a/src/pages/home/platform-carousel/_platform-slider.tsx b/src/pages/home/platform-carousel/_platform-slider.tsx index c11b0842e95..3d1c2e7f752 100644 --- a/src/pages/home/platform-carousel/_platform-slider.tsx +++ b/src/pages/home/platform-carousel/_platform-slider.tsx @@ -105,7 +105,7 @@ type PlatformSliderProps = { const PlatformSlider = ({ slide_index, onSelectSlide, platform_details }: PlatformSliderProps) => { const [viewportRef, embla] = useEmblaCarousel({ startIndex: getSlideStartingIndex(), - loop: true, + loop: getSlideStartingIndex() > 2 ? true : false, axis: 'y', skipSnaps: false, draggable: false, diff --git a/src/pages/home/platform-carousel/_utils.tsx b/src/pages/home/platform-carousel/_utils.tsx index b3c3933633b..bee11b49d7a 100644 --- a/src/pages/home/platform-carousel/_utils.tsx +++ b/src/pages/home/platform-carousel/_utils.tsx @@ -33,6 +33,7 @@ import AppStore from 'images/svg/app-download/app-store.svg' import GooglePlay from 'images/svg/app-download/google-play.svg' import Linux from 'images/svg/app-download/linux.svg' import APK from 'images/svg/app-download/apk.svg' +import { getCountryRule } from 'components/containers/visibility' export const getOSIcon = (type: string) => { if (type === 'browser') return Browser @@ -52,7 +53,7 @@ export type TPlatformDetails = { download_links: Array<{ type: string; url: string }> } -export const platform_details: TPlatformDetails[] = [ +export const platform_details_cr: TPlatformDetails[] = [ { title: 'Deriv GO', icon: DerivGOIcon, @@ -135,12 +136,37 @@ export const platform_details: TPlatformDetails[] = [ }, ] +export const platform_details_eu_uk: TPlatformDetails[] = [ + { + title: 'Deriv MT5', + icon: DMT5Icon, + image_key: 'platforms_mt5', + description: , + learn_more_link: '/dmt5/', + download_links: [ + { type: 'browser', url: deriv_mt5_app_url }, + { type: 'app_store', url: dmt5_macos_url }, + { type: 'linux', url: dmt5_linux_url }, + { type: 'google_play', url: dmt5_android_url }, + ], + }, + { + title: 'DTrader', + icon: DTraderIcon, + image_key: 'platforms_dtrader', + description: , + learn_more_link: '/dtrader/', + download_links: [{ type: 'browser', url: deriv_app_url }], + }, +] + export const getPlatformDetails = (no_of_copies) => { + const { is_row } = getCountryRule() const new_details = [] let current_index = 0 for (let index = 0; index < no_of_copies; index++) { - platform_details.forEach((p) => { + (is_row ? platform_details_cr : platform_details_eu_uk).forEach((p) => { new_details.push({ ...p, id: current_index }) current_index++ }) @@ -149,10 +175,20 @@ export const getPlatformDetails = (no_of_copies) => { return new_details } -export const no_slide_sets = 11 +export const no_slide_sets = () => { + const { is_row } = getCountryRule() + if (!is_row) { + return 1 + } + return 11 +} export const getSlideStartingIndex = () => { - return Math.round((no_slide_sets * 8) / 2 - 2) + const { is_row } = getCountryRule() + if (!is_row) { + return 0 + } + return Math.round((no_slide_sets() * 8) / 2 - 2) } export const ImageTag = styled.img` @@ -169,7 +205,7 @@ const LearnMoreLink = styled(StyledLink)` export type PlatformDetailsProps = { title: string - description: string + description: ReactElement learn_more_link: string icon?: string style?: CSSProperties