Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
fix: regulatory page break (#7554)
Browse files Browse the repository at this point in the history
* fix: regulatory page break

* Dummy commit

* chore: fixed regulatory minified

* fix: heading

* fix: language

* fix: format

* fix: added loading

* change locale to localize

---------

Co-authored-by: Habib Deriv <[email protected]>
Co-authored-by: hasan-deriv <[email protected]>
  • Loading branch information
3 people authored Apr 8, 2024
1 parent 37f3f60 commit 58bf14f
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 192 deletions.
6 changes: 2 additions & 4 deletions crowdin/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4195,8 +4195,8 @@
"-1114192634": "Slovenia",
"-2054234308": "Spain",
"-2121510827": "Sweden",
"-1357648282": "For fair resolution of any complaints, please <0>chat</0> with us. To learn more, see our <1>complaint policy</1>.",
"-1838458999": "For fair resolution of any complaints, please <0>chat</0> with us.",
"-1528857737": "The Financial Commission",
"-791685634": "For fair resolution of any complaints, please contact us via <0>live chat</0>.",
"-672208523": "Deriv Investments (Europe) Limited, incorporated on 22 April 2015 (Company No. C 70156), is based in Malta with its registered address at Level 3, W Business Centre, Triq Dun Karm, Birkirkara BKR9033, and is regulated by the Malta Financial Services Authority under the Investments Services Act to provide investment services (<0>view licence</0>). It serves clients in the European Union, offering accounts for trading financial instruments, and is authorised to operate in other EU member states through EU passporting rights.",
"-632020980": "Here are the EU countries with access to Deriv.com through EU passporting rights.",
"-672414153": "Financial Disclosures Annual Report 2022",
Expand All @@ -4214,8 +4214,6 @@
"-1352186495": "Clients in the rest of the world (except for certain countries such as the USA, Canada, and Hong Kong) who wish to trade CFDs on financial instruments (via MT5 Financial accounts) and derived indices (via MT5 Derived accounts) can have Deriv MT5 accounts under Deriv (BVI) Ltd.",
"-2067457289": "Deriv (V) Ltd (Company No. 014556), incorporated on the 17th February 2016, is registered in the Republic of Vanuatu with its registered office located at 1276, Govant Building, Kumul Highway, Port Vila, Republic of Vanuatu. Deriv (V) Ltd is licensed by the Vanuatu Financial Services Commission (<0>view licence</0>) and is a <1>member</1> of the Financial Markets Association.",
"-674534026": "Deriv (SVG) LLC (Company No. 273 LLC 2020), incorporated on the 12th February 2019, is registered in Saint Vincent and the Grenadines with its registered office located at First Floor, SVG Teachers Credit Union Uptown Building, Corner of James and Middle Street, Kingstown P.O., St Vincent and the Grenadines.",
"-1528857737": "The Financial Commission",
"-791685634": "For fair resolution of any complaints, please contact us via <0>live chat</0>.",
"-1678516609": "Deriv operates and offers its products and services under the Deriv Group, which has several subsidiary companies licensed in their respective jurisdictions.",
"-1937167246": "Return to log in",
"-2054653788": "Forgot your Deriv password? Want to reset your password? Send us your email address and we’ll email you the instructions.",
Expand Down
21 changes: 21 additions & 0 deletions themes/gatsby-theme-deriv/src/components/hooks/use-is-row-cpa.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { useEffect, useState } from 'react'
import useRegion from './use-region'
import useBuildVariant from 'features/hooks/use-build-variant'

function useIsRowCpa() {
const {region} = useBuildVariant()
const [is_row_cpa, setIsRowCpa] = useState(true)
const { is_cpa_plan } = useRegion()

useEffect(() => {
if (region === "row" || is_cpa_plan) {
setIsRowCpa(false)
} else {
setIsRowCpa(true)
}
}, [region, is_cpa_plan])

return is_row_cpa
}

export default useIsRowCpa
Original file line number Diff line number Diff line change
@@ -1,62 +1,92 @@
import React from 'react'
import styled from 'styled-components'
import { Text, LinkText } from 'components/elements'
import { deriv_app_url } from 'common/constants'
import { ContentText } from '@deriv-com/blocks'
import { Text } from '@deriv/quill-design'
import { useLivechat } from 'components/hooks/use-livechat'
import { Localize } from 'components/localization'
import useBuildVariant from 'features/hooks/use-build-variant'

const TextLink = styled(LinkText).attrs({ as: 'span' })``
import { deriv_app_url } from 'common/constants'
import { Localize, localize } from 'components/localization'
import useIsRowCpa from 'components/hooks/use-is-row-cpa'

const FinancialCommission = () => {
const {region} = useBuildVariant();
const [is_livechat_interactive, LC_API] = useLivechat()
const is_row_cpa = useIsRowCpa()

return (
<>
{is_livechat_interactive && (
<div>
{region === "eu" && (
<Text mt="2rem" max_width="58.8rem">
<Localize
translate_text="_t_For fair resolution of any complaints, please <0>chat</0> with us. To learn more, see our <1>complaint policy</1>._t_"
components={[
<TextLink
key={0}
color="red"
className="gtm-deriv-livechat"
onClick={() => {
LC_API.open_chat_window()
}}
/>,
<LinkText
key={0}
color="red"
target="_blank"
rel="noopener noreferrer"
href={`${deriv_app_url}/complaints-policy`}
/>,
]}
/>
</Text>
)}
{region !== "eu" && (
<Text mt="2rem" max_width="58.8rem">
<Localize
translate_text="_t_For fair resolution of any complaints, please <0>chat</0> with us._t_"
components={[
<TextLink
key={0}
color="red"
onClick={() => {
LC_API.open_chat_window()
}}
/>,
]}
/>
</Text>
)}
</div>
{!is_row_cpa ? (
<ContentText
className=" max-w-[816px] mx-auto bg-background-primary-container max-sm:px-800 max-lg:px-1200"
title={localize(`_t_The Financial Commission_t_`)}
>
<Text className="text-start">
<Localize
translate_text="_t_We are registered with the Financial Commission, an international independent organisation dedicated to resolving disputes within the financial services industry (<0>view membership</0>)._t_"
components={[
<a
key={0}
href="/regulatory/deriv-com-ltd-membership.pdf"
className="underline text-typography-default inline text-base"
target="_blank"
rel="noopener noreferrer"
/>,
]}
/>
</Text>
<Text className="text-start">
<Localize
translate_text="_t_For fair resolution of any complaints, please contact us via <0>live chat</0>._t_"
components={[
<span
key={0}
className="underline text-typography-default inline text-base cursor-pointer"
onClick={() => {
is_livechat_interactive && LC_API.open_chat_window()
}}
/>,
]}
/>
</Text>
</ContentText>
) : (
<ContentText
className="max-w-[816px] mx-auto bg-background-primary-container max-sm:px-800 max-lg:px-1200"
title={localize(`_t_The Financial Commission_t_`)}
>
<Text className="text-start pb-800">
<Localize
translate_text="_t_We are registered with the Financial Commission, an international independent organisation dedicated to resolving disputes within the financial services industry (<0>view membership</0>)._t_"
components={[
<a
key={0}
href="/regulatory/deriv-com-ltd-membership.pdf"
className="underline text-typography-default inline text-base"
target="_blank"
rel="noopener noreferrer"
/>,
]}
/>
</Text>
<Text className="text-start">
<Localize
translate_text="_t_For fair resolution of any complaints, please contact us via <0>live chat</0>. To learn more, see our <1>complaint policy</1>._t_"
components={[
<span
key={0}
className="underline text-typography-default inline text-base cursor-pointer"
onClick={() => {
is_livechat_interactive && LC_API.open_chat_window()
}}
/>,
<a
key={1}
href={`${deriv_app_url}/complaints-policy`}
className="underline text-typography-default inline text-base"
target="_blank"
rel="noopener noreferrer"
/>,
]}
/>
</Text>
</ContentText>
)}
</>
)
Expand Down
15 changes: 2 additions & 13 deletions themes/gatsby-theme-deriv/src/pages/regulatory/_info-row-cpa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,10 @@ import React from 'react'
import { ContentText } from '@deriv-com/blocks'
import { Text } from '@deriv/quill-design'
import { Localize } from 'components/localization'
import useBuildVariant from 'features/hooks/use-build-variant'
import useRegion from 'components/hooks/use-region'
import useIsRowCpa from 'components/hooks/use-is-row-cpa'

const InfoRowCpa = () => {
const {region} = useBuildVariant()
const { is_cpa_plan } = useRegion()
const [is_row_cpa, setIsRowCpa] = useState(true)

useEffect(() => {
if (region === "row" || is_cpa_plan) {
setIsRowCpa(false)
} else {
setIsRowCpa(true)
}
}, [region, is_cpa_plan])
const is_row_cpa = useIsRowCpa()

if(is_row_cpa) return null;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
import React from 'react'
import { AccordionBlock, BlockWrapper } from '@deriv-com/blocks'
import { Text, Heading } from '@deriv/quill-design'
import EUgrid from './_eu-grid'
import DocumentAccordion from './_document_accordion'
import * as styles from './eu_grid.module.scss'
import InitialLoader from 'components/elements/dot-loader'
import PDFIcon from 'images/svg/regulatory/pdf-icon-black.svg'
import { Localize, localize } from 'components/localization'
import useBuildVariant from 'features/hooks/use-build-variant'
import useRegion from 'components/hooks/use-region'
import EUgrid from './_eu-grid'
import DocumentAccordion from './_document_accordion'
import * as styles from './eu_grid.module.scss'

const InvestmentEurope = ({ language }: { language: string }) => {
const {region} = useBuildVariant()
const { is_cpa_plan, is_region_loading } = useRegion()
const [is_row_cpa, setIsRowCpa] = useState(true)

useEffect(() => {
if (region === "row" || is_cpa_plan) {
setIsRowCpa(false)
} else {
setIsRowCpa(true)
}
}, [region, is_cpa_plan])
import useIsRowCpa from 'components/hooks/use-is-row-cpa'

if(is_region_loading) <InitialLoader/>
const InvestmentEurope = () => {
const { is_region_loading } = useRegion()
const is_row_cpa = useIsRowCpa()
if(is_region_loading) return <InitialLoader/>

if(!is_row_cpa) return null;

Expand Down Expand Up @@ -98,7 +88,7 @@ const InvestmentEurope = ({ language }: { language: string }) => {
content: function noRefCheck() {
return (
<div>
<DocumentAccordion locale={locale} />
<DocumentAccordion locale={localize} />
</div>
)
},
Expand Down
Loading

0 comments on commit 58bf14f

Please sign in to comment.