diff --git a/imports/api/Utility/server/files.js b/imports/api/Utility/server/files.js index 717f19f..6f02058 100644 --- a/imports/api/Utility/server/files.js +++ b/imports/api/Utility/server/files.js @@ -1,5 +1,7 @@ +/* eslint-disable import/no-absolute-path */ + import fs from 'fs'; -import getFallbackLang from '/imports/startup/server/accounts/lang-fallback'; +import getFallbackLang from '/imports/modules/lang-fallback'; const as = f => `assets/app/${f}`; diff --git a/imports/startup/server/accounts/lang-fallback.js b/imports/modules/lang-fallback.js similarity index 69% rename from imports/startup/server/accounts/lang-fallback.js rename to imports/modules/lang-fallback.js index 67fbb66..d912347 100644 --- a/imports/startup/server/accounts/lang-fallback.js +++ b/imports/modules/lang-fallback.js @@ -1,5 +1,6 @@ const getFallbackLang = (lang) => { - if (lang && (lang === 'ast' || lang === 'gl' || lang === 'eu' || lang === 'ca' || lang.match(/^es-/))) { + if (lang && (lang === 'ast' || lang === 'gl' || lang === 'eu' || + lang === 'es' || lang === 'ca' || lang.match(/^es-/))) { return 'es'; } return 'en'; diff --git a/imports/startup/server/accounts/on-create-user.js b/imports/startup/server/accounts/on-create-user.js index 383b8c0..566acc6 100644 --- a/imports/startup/server/accounts/on-create-user.js +++ b/imports/startup/server/accounts/on-create-user.js @@ -1,7 +1,9 @@ +/* eslint-disable import/no-absolute-path */ + import { Accounts } from 'meteor/accounts-base'; -import sendWelcomeEmail from '../../../api/Users/server/send-welcome-email'; -import getOAuthProfile from '../../../modules/get-oauth-profile'; -import getFallbackLang from './lang-fallback'; +import getFallbackLang from '/imports/modules/lang-fallback'; +import sendWelcomeEmail from '/imports/api/Users/server/send-welcome-email'; +import getOAuthProfile from '/imports/modules/get-oauth-profile'; Accounts.onCreateUser((options, user) => { const userToCreate = user; diff --git a/imports/ui/pages/Index/Index.js b/imports/ui/pages/Index/Index.js index 4bb5a59..9e3d6fd 100644 --- a/imports/ui/pages/Index/Index.js +++ b/imports/ui/pages/Index/Index.js @@ -18,6 +18,7 @@ import { isAnyMobile } from '/imports/ui/components/Utils/isMobile'; import SubscriptionEditor from '/imports/ui/components/SubscriptionEditor/SubscriptionEditor'; import SubscriptionsMap from '/imports/ui/pages/Subscriptions/SubscriptionsMap'; import ShareIt from '/imports/ui/components/ShareIt/ShareIt'; +import getFallbackLang from '/imports/modules/lang-fallback'; import FiresMap from '../FiresMap/FiresMap'; import './Index.scss'; @@ -34,6 +35,7 @@ class Index extends Component { self.scaleHeader(); }, 250); this.onResize = this.onResize.bind(this); + this.getBotUrl = this.getBotUrl.bind(this); } componentDidMount() { @@ -67,6 +69,14 @@ class Index extends Component { return (
); } + getBotUrl() { + const fallbackLng = getFallbackLang(this.props.i18n.language); + console.log(`language: ${this.props.i18n.language}, fallback: ${fallbackLng}`); + return fallbackLng === 'es' ? + 'https://t.me/TodosContraElFuego_bot' : + 'https://t.me/AllAgainstTheFire_bot'; + } + scaleHeader() { const scalable = document.getElementById('tcefh1'); const margin = 10; @@ -79,7 +89,7 @@ class Index extends Component { } handleBtnClick() { - window.open('https://t.me/TodosContraElFuego_bot', '_blank'); + window.open(this.getBotUrl(), '_blank'); } gotoParticipe() { @@ -270,7 +280,7 @@ class Index extends Component {
- +

Telegram

@@ -318,6 +328,7 @@ class Index extends Component { Index.propTypes = { history: PropTypes.object.isRequired, + i18n: PropTypes.object.isRequired, t: PropTypes.func.isRequired };