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

Commit 125eca2

Browse files
authored
Merge pull request #3856 from rupato-deriv/Rupato/91559/redirect-users-to-bot-deriv
Rupato/91559/redirect users to bot deriv
2 parents 1770a68 + 4914751 commit 125eca2

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

gulp/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ gulp.task(
8686
gulp.task(
8787
'pull-blockly-translations',
8888
gulp.series(done => {
89-
const blocklyLanguages = ['en', 'id', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant'];
89+
const blocklyLanguages = ['en', 'it', 'vi', 'pl', 'ru', 'pt', 'es', 'fr', 'zh-hans', 'zh-hant'];
9090
remoteSrc(
9191
blocklyLanguages.map(lang => `${lang}.js?_=${Date.now()}`),
9292
{

src/common/i18n.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import es from './translations/es_ES/i10n.json';
1111
import fr from './translations/fr_FR/i10n.json';
1212
import en from './translations/en/i10n.json';
1313
import ach from './translations/ach_UG/i10n.json';
14-
import id from './translations/id_ID/i10n.json';
1514

1615
export const supportedLanguages = {
1716
zh_tw: zhTw,
@@ -25,7 +24,6 @@ export const supportedLanguages = {
2524
fr,
2625
en,
2726
ach,
28-
id,
2927
};
3028

3129
const fallbackLang = en;

src/common/lang.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@ import BotLanding from '../indexPage/react-components/bot-landing';
99

1010
const elements = ['#notification-banner', '#main', '#footer', '#header'];
1111
export const getLanguage = () => {
12-
const queryLang = parseQueryString().l;
13-
const lang = queryLang in supportedLanguages ? queryLang : getStorage('lang') || 'en';
12+
const queryLang = parseQueryString().l || 'en';
13+
const checkIsSupported = queryLang in supportedLanguages;
14+
// eslint-disable-next-line camelcase
15+
const un_supported_languages = ['id', 'tr'];
16+
const checkLanguageNotSupported = () =>
17+
un_supported_languages.includes(queryLang) ? 'en' : getStorage('lang') || 'en';
18+
const lang = checkIsSupported ? queryLang : checkLanguageNotSupported();
1419
setStorage('lang', lang);
1520
setCookieLanguage(lang);
1621
return lang;
@@ -31,7 +36,6 @@ const addUiLang = () => {
3136
export const load = () => {
3237
if (typeof $ !== 'function') return; // Adding this check to skip unit test
3338
const lang = getLanguage();
34-
3539
$('#select_language li:not(:first)').click(function click() {
3640
const newLang = $(this).attr('class');
3741
if (
@@ -43,7 +47,7 @@ export const load = () => {
4347
render(<BotLanding />, document.getElementById('bot-landing'));
4448
elements.map(elem => document.querySelector(elem).classList.add('hidden'));
4549
document.getElementById('bot-landing').classList.remove('hidden');
46-
document.getElementById('bot-main').classList.remove('hidden');
50+
document.getElementById('bot-main').classList.add('hidden');
4751
document.location.search = `l=${newLang}`;
4852
$('.barspinner').hide();
4953
} else {
@@ -68,6 +72,7 @@ export const load = () => {
6872
script.src = `${document.location.protocol}//cdn.crowdin.com/jipt/jipt.js`;
6973
$('body').append(script);
7074
}
75+
console.log(lang, 'dnashjdnajksdnajksdnakjsdnksajnkjs');
7176

7277
init(lang);
7378

src/common/utils/tools.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ export const parseQueryString = () => {
1010
str.replace(new RegExp('([^?=&]+)(=([^&]*))?', 'g'), (a0, a1, a2, a3) => {
1111
objURL[a1] = a3;
1212
});
13-
return objURL;
13+
14+
return objURL || false;
1415
};
1516
export const generateURL = url => {
1617
if (url.split('?').length !== null && url.split('?').length !== undefined) {

src/indexPage/index.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { isEuCountry, showHideEuElements } from '../common/footer-checks';
88
import GTM from '../common/gtm';
99
import { load as loadLang, showBanner } from '../common/lang';
1010
import { moveToDeriv } from '../common/utils/utility';
11-
import { get as getStorage, set as setStorage, remove, getTokenList } from '../common/utils/storageManager';
11+
import { get as getStorage, remove, getTokenList } from '../common/utils/storageManager';
1212
import { createUrl, isBinaryDomain, parseQueryString, serialize } from '../common/utils/tools';
1313
import '../common/binary-ui/dropdown';
1414
import BotLanding from './react-components/bot-landing';
@@ -21,7 +21,6 @@ const sevenDays = 7;
2121
const oneMinute = 60;
2222
const oneDay = 24;
2323

24-
export const elements = ['#notification-banner', '#main', '#footer', '#header', '#topbar'];
2524
// eslint-disable-next-line one-var
2625
export const bannerToken = getStorage('setDueDateForBanner');
2726

@@ -72,7 +71,6 @@ export const setTimeOutBanner = route => {
7271
(route === 'views' && checkifBotRunning() === true)
7372
) {
7473
remove('setDueDateForBanner');
75-
setStorage('setDueDateForBanner', expirationDate());
7674
return false;
7775
}
7876
}, calcSetTimeoutValueBanner);
@@ -82,12 +80,7 @@ export const renderBanner = () => {
8280
if (window.location.pathname.indexOf('/bot') === -1 || window.location.pathname === '/movetoderiv.html') {
8381
getComponent();
8482
render(Component, document.getElementById(dynamicRoutePathanme));
85-
if (dynamicRoutePathanme === 'bot-landing') {
86-
setStorage('setDueDateForBanner', expirationDate());
87-
}
88-
elements.map(elem => document.querySelector(elem).classList.add('hidden'));
8983
document.getElementById(dynamicRoutePathanme).classList.remove('hidden');
90-
document.getElementById('bot-main').classList.remove('hidden');
9184
document.getElementById('topbar').classList.remove('hidden');
9285
$('.barspinner').hide();
9386
}
@@ -103,11 +96,13 @@ const renderElements = () => {
10396
if (!bannerToken) {
10497
if (window.location.pathname.indexOf('/bot') === -1) {
10598
renderBanner();
99+
document.getElementById('bot-main').classList.add('hidden');
106100
}
107101
} else {
108102
if (today > bannerToken) {
109103
remove('setDueDateForBanner');
110104
renderBanner();
105+
document.getElementById('bot-main').classList.add('hidden');
111106
return false;
112107
}
113108
if (window.location.pathname.indexOf('/bot') === -1) {
@@ -119,10 +114,9 @@ const renderElements = () => {
119114
'href',
120115
createUrl({ subdomain: 'shop', path: 'collections/strategies', isNonBotPage: true })
121116
);
122-
elements.map(elem => document.querySelector(elem).classList.remove('hidden'));
123117
document.getElementById(dynamicRoutePathanme).classList.add('hidden');
124118
}
125-
document.getElementById('bot-main').classList.remove('hidden');
119+
126120
setTimeout(() => {
127121
$('.barspinner').hide();
128122
}, 2000);
@@ -152,6 +146,7 @@ const loginCheck = () => {
152146
} else {
153147
setTimeout(() => {
154148
renderBanner();
149+
document.getElementById('bot-main').classList.add('hidden');
155150
}, 0);
156151
}
157152
};

src/indexPage/react-components/bot-landing/Hero.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react'
22
import { translate } from '../../../common/i18n';
3-
import { generateURL } from '../../../common/utils/tools'
43

54
const Hero = () => (
65
<section className="hero">
@@ -15,9 +14,7 @@ const Hero = () => (
1514
<a href="https://bot.deriv.com">
1615
<button className="l-btn primary">{translate('Take me to Binary Bot on Deriv')}</button>
1716
</a>
18-
<a href={generateURL(window.location.href)}>
19-
<button className="l-btn">{translate('Maybe later')}</button>
20-
</a>
17+
2118
</div>
2219
</div>
2320
<div className="hero-inner__placeholder">

src/indexPage/react-components/bot-landing/SwitchSection.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const SwitchSection = () => (
1919
<a href={getOAuthURLDeriv()}>
2020
<button className="l-btn danger">{translate('Try it now')}</button>
2121
</a>
22-
<a href={generateURL(window.location.href)}>
23-
<button className="l-btn transparent">{translate('Maybe later')}</button>
24-
</a>
22+
2523
</div>
2624
</div>
2725
</div>

static/css/_landing.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ $header-color : #333333;
2626
margin: 0 auto;
2727
max-width: 1400px;
2828
}
29-
3029
.hero {
3130
background: $hero-BG url(../image/BG-1.webp) no-repeat;
3231
background-size: cover;

static/css/bot.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ body {
3131
font-size: 1em;
3232
}
3333

34+
#bot-main{
35+
background: $hero-BG url(../image/BG-1.webp) no-repeat !important;
36+
background-size: cover !important;
37+
position: absolute;
38+
height: 100%;
39+
z-index: -1;
40+
}
41+
3442
#server-status .online {
3543
background-color: green;
3644
}

templates/index.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</head>
1717

1818
<body>
19-
<div id="bot-main" class="hidden" style="width: 100%; position: relative;">
19+
<div id="bot-main" style="width: 100%; position: relative;">
2020
{{> ../templates/partials/loading }}
2121
</div>
2222
<div id="topbar">
@@ -27,17 +27,17 @@
2727
<div id="movetoderiv"></div>
2828
<div id="bot-landing"></div>
2929

30-
<div id="header">
30+
<div id="header" class="hidden">
3131
<div class="wrapper">
3232
<div class="logo-wrapper">
3333
<div id="binary-logo"></div>
3434
{{> ../templates/partials/bbot-to-deriv-banner }}
3535
</div>
3636
</div>
3737
</div>
38-
<div id="notification-banner"></div>
38+
<div id="notification-banner" class="hidden"></div>
3939
<div id="bot-landing-alert-popup" class="bot-landing-alert bot-landing-alert-popup"></div>
40-
<div id="main">
40+
<div id="main" class="hidden">
4141
<div>
4242
<div class="content show-on-load">
4343
<h1 class="center" data-i18n-text="Binary Bot"></h1>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy