diff --git a/digitransit-component/packages/digitransit-component-control-panel/package.json b/digitransit-component/packages/digitransit-component-control-panel/package.json
index 1dd0b6ef9d..7b5c56a801 100644
--- a/digitransit-component/packages/digitransit-component-control-panel/package.json
+++ b/digitransit-component/packages/digitransit-component-control-panel/package.json
@@ -1,6 +1,6 @@
{
"name": "@digitransit-component/digitransit-component-control-panel",
- "version": "1.1.8",
+ "version": "2.0.0",
"description": "digitransit-component control-panel module",
"main": "index.js",
"files": [
diff --git a/digitransit-component/packages/digitransit-component-control-panel/src/index.js b/digitransit-component/packages/digitransit-component-control-panel/src/index.js
index a37e345afe..8a783fad54 100644
--- a/digitransit-component/packages/digitransit-component-control-panel/src/index.js
+++ b/digitransit-component/packages/digitransit-component-control-panel/src/index.js
@@ -4,8 +4,6 @@
import PropTypes from 'prop-types';
import React, { Fragment, useEffect, useState } from 'react';
import i18next from 'i18next';
-import { useCookies } from 'react-cookie';
-import cx from 'classnames';
import Icon from '@digitransit-component/digitransit-component-icon';
import styles from './helpers/styles.scss';
import translations from './helpers/translations';
@@ -67,73 +65,6 @@ OriginToDestination.defaultProps = {
language: 'fi',
};
-function BubbleDialog({ title, content, closeDialog, shouldRender, lang }) {
- const [show, setShow] = useState(false);
- useEffect(() => {
- setTimeout(() => {
- setShow(true);
- }, 500);
- }, [show]);
-
- return (
-
-
-
-
- {title}
-
-
- {content}
-
-
-
-
-
-
- );
-}
-
-BubbleDialog.propTypes = {
- title: PropTypes.string.isRequired,
- content: PropTypes.string.isRequired,
- closeDialog: PropTypes.func.isRequired,
- shouldRender: PropTypes.bool.isRequired,
- lang: PropTypes.string.isRequired,
-};
-
/**
* Show button links to near you page for different travel modes
*
@@ -196,15 +127,11 @@ function NearStopsAndRoutes({
modeSet,
modeIconColors,
fontWeights,
- showTeaser,
}) {
const [modesWithAlerts, setModesWithAlerts] = useState([]);
- const [cookies, setCookie] = useCookies(['nearbyTeaserShown']);
useEffect(() => {
- Object.keys(translations).forEach(lang => {
- i18next.addResourceBundle(lang, 'translation', translations[lang]);
- });
+ i18next.changeLanguage(language);
if (alertsContext) {
alertsContext
.getModesWithAlerts(alertsContext.currentTime, alertsContext.feedIds)
@@ -214,12 +141,6 @@ function NearStopsAndRoutes({
}
}, []);
- const closeBubbleDialog = () =>
- setCookie('nearbyTeaserShown', true, {
- path: '/',
- maxAge: 10 * 365 * 24 * 60 * 60,
- });
-
let urlStart;
if (omitLanguageUrl) {
urlStart = urlPrefix;
@@ -328,20 +249,6 @@ function NearStopsAndRoutes({
: title[language]}
)}
- {showTeaser && !cookies?.nearbyTeaserShown && (
-
- )}
{
+ i18next.addResourceBundle(lang, 'translation', translations[lang]);
+ });
+ }
+
render() {
const className =
this.props.position === 'bottom'
? styles['main-bottom']
: styles['main-left'];
- const children = React.Children.map(this.props.children, child => {
- if (child) {
- let lang = this.props.language;
- if (lang === undefined) {
- lang = 'fi';
- }
- i18next.changeLanguage(lang);
- return React.cloneElement(child, { lang });
- }
- return null;
- });
return (
- {children}
+ {this.props.children}
);
}
diff --git a/digitransit-component/packages/digitransit-component/package.json b/digitransit-component/packages/digitransit-component/package.json
index 10045a9523..ffbee607d6 100644
--- a/digitransit-component/packages/digitransit-component/package.json
+++ b/digitransit-component/packages/digitransit-component/package.json
@@ -16,7 +16,7 @@
"dependencies": {
"@digitransit-component/digitransit-component-autosuggest": "^2.0.8",
"@digitransit-component/digitransit-component-autosuggest-panel": "^3.0.8",
- "@digitransit-component/digitransit-component-control-panel": "^1.1.8",
+ "@digitransit-component/digitransit-component-control-panel": "^2.0.0",
"@digitransit-component/digitransit-component-favourite-bar": "2.0.5",
"@digitransit-component/digitransit-component-favourite-editing-modal": "^2.0.2",
"@digitransit-component/digitransit-component-favourite-modal": "^1.0.6",
diff --git a/yarn.lock b/yarn.lock
index 16cad571df..1b00cb003e 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2013,7 +2013,7 @@ __metadata:
languageName: unknown
linkType: soft
-"@digitransit-component/digitransit-component-control-panel@^1.1.8, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel":
+"@digitransit-component/digitransit-component-control-panel@^2.0.0, @digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel":
version: 0.0.0-use.local
resolution: "@digitransit-component/digitransit-component-control-panel@workspace:digitransit-component/packages/digitransit-component-control-panel"
peerDependencies:
@@ -2168,7 +2168,7 @@ __metadata:
dependencies:
"@digitransit-component/digitransit-component-autosuggest": ^2.0.8
"@digitransit-component/digitransit-component-autosuggest-panel": ^3.0.8
- "@digitransit-component/digitransit-component-control-panel": ^1.1.8
+ "@digitransit-component/digitransit-component-control-panel": ^2.0.0
"@digitransit-component/digitransit-component-favourite-bar": 2.0.5
"@digitransit-component/digitransit-component-favourite-editing-modal": ^2.0.2
"@digitransit-component/digitransit-component-favourite-modal": ^1.0.6