Skip to content
This repository was archived by the owner on Feb 22, 2024. It is now read-only.

Commit 81b87d6

Browse files
committed
Verberg elementen voor EU gebruikers
1 parent 8698f5c commit 81b87d6

File tree

5 files changed

+34
-11
lines changed

5 files changed

+34
-11
lines changed

src/botPage/view/View.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
addTokenIfValid,
2929
} from '../../common/appId';
3030
import { translate } from '../../common/i18n';
31+
import isEuCountry, { showHideEuElements } from '../../common/footer-checks';
3132
import googleDrive from '../../common/integrations/GoogleDrive';
3233
import { getLanguage } from '../../common/lang';
3334
import { observer as globalObserver } from '../../common/utils/observer';
@@ -212,7 +213,9 @@ const updateTokenList = () => {
212213
$('.account-type').text(`${prefix}`);
213214
} else {
214215
$('.login-id-list').append(
215-
`<a href="#" value="${tokenInfo.token}"><li><span>${prefix}</span><div>${tokenInfo.accountName}</div></li></a><div class="separator-line-thin-gray"></div>`
216+
`<a href="#" value="${tokenInfo.token}"><li><span>${prefix}</span><div>${
217+
tokenInfo.accountName
218+
}</div></li></a><div class="separator-line-thin-gray"></div>`
216219
);
217220
}
218221
});
@@ -724,6 +727,7 @@ function initRealityCheck(stopCallback) {
724727
);
725728
}
726729
function renderReactComponents() {
730+
isEuCountry().then(isEu => showHideEuElements(isEu));
727731
ReactDOM.render(<ServerTime api={api} />, $('#server-time')[0]);
728732
ReactDOM.render(<Tour />, $('#tour')[0]);
729733
ReactDOM.render(

src/common/footer-checks.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,33 @@
11
/* eslint-disable import/prefer-default-export */
22
import { generateLiveApiInstance } from './appId';
33

4+
export const showHideEuElements = isEu => {
5+
document.querySelectorAll('.eu-hide').forEach(el => {
6+
if (!isEu && el.classList.contains('invisible')) {
7+
// Keep original display type if invisible was specified.
8+
el.classList.remove('invisible');
9+
} else {
10+
// Default to setting display to block.
11+
el.setAttribute('display', `${!isEu ? 'block' : 'none'} !important`);
12+
}
13+
});
14+
document.querySelectorAll('.eu-show', '.eu-only').forEach(el => {
15+
if (isEu && el.classList.contains('invisible')) {
16+
el.classList.remove('invisible');
17+
} else {
18+
el.setAttribute('display', `${isEu ? 'block' : 'none'} !important`);
19+
}
20+
});
21+
};
22+
423
export default async function isEuCountry() {
524
const api = generateLiveApiInstance();
6-
const { website_status: { clients_country: clientsCountry } } = await api.send({ website_status: 1 });
7-
const { landing_company: { financial_company: financialCompany, gaming_company: gamingCompany } } = await api.send({
25+
const {
26+
website_status: { clients_country: clientsCountry },
27+
} = await api.send({ website_status: 1 });
28+
const {
29+
landing_company: { financial_company: financialCompany, gaming_company: gamingCompany },
30+
} = await api.send({
831
landing_company: clientsCountry,
932
});
1033

src/indexPage/index.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@ import Logo from './react-components/logo.jsx';
55
import Footer from './react-components/footer.jsx';
66
import { oauthLogin } from '../common/appId';
77
import '../common/binary-ui/dropdown';
8-
import isEuCountry from '../common/footer-checks';
8+
import isEuCountry, { showHideEuElements } from '../common/footer-checks';
99
import GTM from '../common/gtm';
1010
import { load as loadLang } from '../common/lang';
1111
import { getTokenList } from '../common/utils/storageManager';
1212
import { createUrl } from '../common/utils/tools';
1313

1414
const renderElements = () => {
15-
const showHideEuElements = isEu => {
16-
$('.eu-hide').attr('style', `display: ${isEu ? 'none' : 'block'} !important`);
17-
$('.eu-show, .eu-only').attr('style', `display: ${isEu ? 'block' : 'none'} !important`);
18-
};
1915
ReactDOM.render(<Logo />, document.getElementById('binary-logo'));
2016
ReactDOM.render(<Footer />, document.getElementById('footer'));
2117
isEuCountry().then(isEu => {

static/css/_dbot-banner.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@
6363
}
6464
}
6565

66-
@media only screen and (max-width: 600px) {
66+
@media only screen and (max-width: 520px) {
6767
.dbot-banner {
6868
display: none;
6969
}
7070
}
7171

72-
@media only screen and (max-width: 769px) {
72+
@media only screen and (max-width: 700px) {
7373
.dbot-banner {
7474
&__separator {
7575
display: none;

templates/partials/dbot-banner.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="dbot-banner">
1+
<div class="dbot-banner eu-hide invisible">
22
<div class="dbot-banner__separator"></div>
33
<div class="dbot-banner__icon">
44
<a href="https://deriv.com/interim/deriv/?utm_source=binary-bot&utm_medium=referral&utm_campaign=deriv-launch" target="_blank">

0 commit comments

Comments
 (0)