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.

Nikolai.berstevich/fix/update link to terms 38541 #1931

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions src/common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const domain_url =
: deriv_com_url

// 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
export const deriv_app_url = `https://app.${domain_url}`
export const deriv_developer_url = `https://developers.${domain_url}`
Expand Down Expand Up @@ -75,6 +76,7 @@ export const localized_link_url = Object.freeze({
mt5: deriv_mt5_app_url,
smart_trader: smarttrader_url,
zoho: zoho_url,
terms_and_conditions: domain_full_url,
})
export const default_server_url = 'green.binaryws.com'

Expand Down
21 changes: 7 additions & 14 deletions src/components/custom/_agreement-label.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react'
import React from 'react'
import PropTypes from 'prop-types'
import styled from 'styled-components'
import { LinkText, Checkbox } from 'components/elements'
import { Checkbox, LocalizedLinkText } from 'components/elements'
import { Localize } from 'components/localization'
import device from 'themes/device.js'

Expand All @@ -12,19 +12,12 @@ const CheckboxSpan = styled.span`
font-size: 1.75rem;
}
`
const AgreementLabel = ({ handleChangeCheckbox, isChecked, color }) => {
const [language_code, setLanguageCode] = useState('en')

useEffect(() => {
setLanguageCode(localStorage.getItem('i18n'))
}, [])

const AgreementLabel = ({ handleChangeCheckbox, isChecked, color }) => {
const handleChange = (event) => {
handleChangeCheckbox(event)
}

const url = `/${language_code}/terms-and-conditions/`

return (
<label
style={{
Expand All @@ -51,13 +44,13 @@ const AgreementLabel = ({ handleChangeCheckbox, isChecked, color }) => {
fontSize="var(--text-size-xs)"
translate_text="I agree to the <0>terms and conditions</0>"
components={[
<LinkText
<LocalizedLinkText
key={0}
href={url}
target="_blank"
type="terms_and_conditions"
external="true"
rel="noopener noreferrer"
size="14px"
color="red"
rel="noopener noreferrer"
/>,
]}
/>
Expand Down
12 changes: 10 additions & 2 deletions src/components/localization/localized-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ const affiliate_links = ['affiliate_sign_in', 'affiliate_sign_up']
const deriv_app_links = ['dbot', 'deriv_app', 'mt5', 'derivx']
const deriv_other_products = ['binary', 'smart_trader']
const deriv_social_platforms = ['blog', 'community', 'developers', 'zoho']
// add item to this array if you need to make an internal link open on a new tab without modal window
const new_tab_no_modal = ['terms_and_conditions']

const getURLFormat = (type, locale, to, affiliate_lang) => {
if (deriv_app_links.includes(type)) {
Expand All @@ -151,6 +153,11 @@ const getURLFormat = (type, locale, to, affiliate_lang) => {
return `${localized_link_url[type]}/${getThaiExcludedLocale(locale)}/${to}.html`
} else if (deriv_social_platforms.includes(type)) {
return `${localized_link_url[type]}${to}`
} else if (new_tab_no_modal.includes(type)) {
return `${localized_link_url[type]}${locale === 'en' ? '' : '/' + locale}/${type.replace(
/_/g,
'-',
)}`
} else {
return to
}
Expand Down Expand Up @@ -181,7 +188,8 @@ const ExternalLink = ({
!is_mail_link &&
!affiliate_links.includes(type) &&
!deriv_app_links.includes(type) &&
!deriv_social_platforms.includes(type)
!deriv_social_platforms.includes(type) &&
!new_tab_no_modal.includes(type)

const default_style = { cursor: 'pointer' }

Expand Down Expand Up @@ -209,7 +217,7 @@ const ExternalLink = ({
href={!show_modal ? url : ''}
onClick={handleClick}
disabled={!mounted}
target={target}
target={new_tab_no_modal.includes(type) ? '__blank' : target}
rel={rel}
{...props}
>
Expand Down