1
+ import React from 'react' ;
2
+ import { render } from 'react-dom' ;
1
3
import { parseQueryString } from '../common/utils/tools' ;
2
- import { set as setStorage , get as getStorage } from '../common/utils/storageManager' ;
4
+ import { set as setStorage , get as getStorage , remove } from '../common/utils/storageManager' ;
3
5
import { setCookieLanguage } from '../common/utils/cookieManager' ;
4
6
import { supportedLanguages , translate , init } from './i18n' ;
5
7
import { getClientsCountryByIP } from './utils/utility' ;
8
+ import BotLanding from '../indexPage/react-components/bot-landing' ;
6
9
10
+ const elements = [ '#notification-banner' , '#main' , '#footer' , '#header' ] ;
7
11
export const getLanguage = ( ) => {
8
12
const queryLang = parseQueryString ( ) . l ;
9
13
const lang = queryLang in supportedLanguages ? queryLang : getStorage ( 'lang' ) || 'en' ;
@@ -30,7 +34,17 @@ export const load = () => {
30
34
31
35
$ ( '#select_language li:not(:first)' ) . click ( function click ( ) {
32
36
const newLang = $ ( this ) . attr ( 'class' ) ;
33
- document . location . search = `l=${ newLang } ` ;
37
+ if ( document . getElementById ( 'bot-landing' ) . classList . contains ( 'hidden' ) === false ) {
38
+ remove ( 'setDueDateForBanner' ) ;
39
+ render ( < BotLanding /> , document . getElementById ( 'bot-landing' ) ) ;
40
+ elements . map ( elem => document . querySelector ( elem ) . classList . add ( 'hidden' ) ) ;
41
+ document . getElementById ( 'bot-landing' ) . classList . remove ( 'hidden' ) ;
42
+ document . getElementById ( 'bot-main' ) . classList . remove ( 'hidden' ) ;
43
+ $ ( '.barspinner' ) . hide ( ) ;
44
+ document . location . search = `l=${ newLang } ` ;
45
+ } else {
46
+ document . location . search = `l=${ newLang } ` ;
47
+ }
34
48
} ) ;
35
49
36
50
$ ( '.language' ) . text (
0 commit comments