diff --git a/src/scripts/components/layers/layer-selector/layer-selector.tsx b/src/scripts/components/layers/layer-selector/layer-selector.tsx index 3b5ee4305..eac383fe3 100644 --- a/src/scripts/components/layers/layer-selector/layer-selector.tsx +++ b/src/scripts/components/layers/layer-selector/layer-selector.tsx @@ -72,6 +72,7 @@ const LayerSelector: FunctionComponent = () => { selectedLayerIds={selectedLayerIds} onSelect={(layerId, isMain) => { dispatch(setSelectedLayerIdsAction(layerId, isMain)); + dispatch(showLayerSelectorAction(false)); const name = layers.find(layer => layer.id === layerId)?.name; diff --git a/src/scripts/components/main/icons/ubilabs-logo.tsx b/src/scripts/components/main/icons/ubilabs-logo.tsx index 757ced1cb..bbf436726 100644 --- a/src/scripts/components/main/icons/ubilabs-logo.tsx +++ b/src/scripts/components/main/icons/ubilabs-logo.tsx @@ -1,32 +1,45 @@ import React, {FunctionComponent} from 'react'; export const Ubilabslogo: FunctionComponent = () => ( - - - - - - - - - - - + + + + + + + + + + + ); diff --git a/src/scripts/config/main.ts b/src/scripts/config/main.ts index 29c7fad8c..654eb4941 100644 --- a/src/scripts/config/main.ts +++ b/src/scripts/config/main.ts @@ -80,7 +80,7 @@ export default { 'http://twitter.com/intent/tweet?text=ESA%20Climate%20From%20Space&url={currentUrl}' }, planeratyVisionsLogo: 'assets/images/planetary-visions.png', - ubilabsWebsite: 'https://ubilabs.net', + ubilabsWebsite: 'https://ubilabs.com', planetaryVisionsWebsite: 'http://planetaryvisions.com/', githubRepo: 'https://github.com/ubilabs/esa-climate-from-space', cciWebsite: 'https://climate.esa.int/', diff --git a/src/scripts/libs/language-url-parameter.ts b/src/scripts/libs/language-url-parameter.ts new file mode 100644 index 000000000..756bdcb79 --- /dev/null +++ b/src/scripts/libs/language-url-parameter.ts @@ -0,0 +1,19 @@ +import {Language} from '../types/language'; +// parses window.location and reads the story tags from query params +// +// note: we do not use the location.search prop here because the HashRouter + +// stores the query parameters in the location.hash prop +export function parseUrl(): Language | null { + const {hash} = location; + + const queryString = hash.substr(hash.indexOf('?')); + const urlParams = new URLSearchParams(queryString); + const languageParam = urlParams.get('lng') as Language; + + if (!languageParam) { + return null; + } + + return languageParam; +} diff --git a/src/scripts/reducers/language.ts b/src/scripts/reducers/language.ts index 294ed4a15..a75cbc1c1 100644 --- a/src/scripts/reducers/language.ts +++ b/src/scripts/reducers/language.ts @@ -1,11 +1,13 @@ import {SET_LANGUAGE, SetLanguageAction} from '../actions/set-language'; import getBrowserLanguage from '../libs/get-browser-language'; import getLocalStorageLanguage from '../libs/get-local-storage-language'; +import { parseUrl } from '../libs/language-url-parameter'; import {Language} from '../types/language'; -const initialState: Language = - getLocalStorageLanguage() || getBrowserLanguage() || Language.EN; + + +const initialState: Language = parseUrl() || getLocalStorageLanguage() || getBrowserLanguage() || Language.EN; function languageReducer( state: Language = initialState,