Merge pull request #9510 from jfsiebel/move-intl

Move Intl component outside of Base component
This commit is contained in:
Anton Georgiev 2020-05-12 17:02:11 -04:00 committed by GitHub
commit 231c962029
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 16 deletions

View File

@ -1,7 +1,7 @@
/*
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
Copyright (c) 2019 BigBlueButton Inc. and by respective authors (see below).
Copyright (c) 2020 BigBlueButton Inc. and by respective authors (see below).
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
@ -24,6 +24,7 @@ import Base from '/imports/startup/client/base';
import JoinHandler from '/imports/ui/components/join-handler/component';
import AuthenticatedHandler from '/imports/ui/components/authenticated-handler/component';
import Subscriptions from '/imports/ui/components/subscriptions/component';
import IntlStartup from '/imports/startup/client/intl';
Meteor.startup(() => {
// Logs all uncaught exceptions to the client logger
@ -53,7 +54,9 @@ Meteor.startup(() => {
<JoinHandler>
<AuthenticatedHandler>
<Subscriptions>
<IntlStartup>
<Base />
</IntlStartup>
</Subscriptions>
</AuthenticatedHandler>
</JoinHandler>,

View File

@ -12,7 +12,6 @@ import logger from '/imports/startup/client/logger';
import Users from '/imports/api/users';
import { Session } from 'meteor/session';
import { FormattedMessage } from 'react-intl';
import IntlStartup from './intl';
import Meetings, { RecordMeetings } from '../../api/meetings';
import AppService from '/imports/ui/components/app/service';
import Breakouts from '/imports/api/breakouts';
@ -33,14 +32,12 @@ let breakoutNotified = false;
const propTypes = {
subscriptionsReady: PropTypes.bool,
locale: PropTypes.string,
approved: PropTypes.bool,
meetingHasEnded: PropTypes.bool.isRequired,
meetingExist: PropTypes.bool,
};
const defaultProps = {
locale: undefined,
approved: false,
meetingExist: false,
subscriptionsReady: false,
@ -209,19 +206,13 @@ class Base extends Component {
}
render() {
const { updateLoadingState } = this;
const { locale, meetingExist } = this.props;
const stateControls = { updateLoadingState };
const { meetingExist } = this.props;
const { meetingExisted } = this.state;
return (
(!meetingExisted && !meetingExist && Auth.loggedIn)
? <LoadingScreen />
: (
<IntlStartup locale={locale} baseControls={stateControls}>
{this.renderByState()}
</IntlStartup>
)
: this.renderByState()
);
}
}
@ -231,7 +222,6 @@ Base.defaultProps = defaultProps;
const BaseContainer = withTracker(() => {
const {
locale,
animations,
userJoinAudioAlerts,
userJoinPushAlerts,
@ -367,7 +357,6 @@ const BaseContainer = withTracker(() => {
return {
approved,
ejected,
locale,
userSubscriptionHandler,
breakoutRoomSubscriptionHandler,
meetingModeratorSubscriptionHandler,

View File

@ -1,4 +1,5 @@
import React, { Component } from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import PropTypes from 'prop-types';
import { IntlProvider, addLocaleData } from 'react-intl';
import Settings from '/imports/ui/services/settings';
@ -194,7 +195,15 @@ class IntlStartup extends Component {
}
}
export default IntlStartup;
const IntlStartupContainer = withTracker(() => {
const { locale } = Settings.application;
return {
locale,
};
})(IntlStartup);
export default IntlStartupContainer;
IntlStartup.propTypes = propTypes;
IntlStartup.defaultProps = defaultProps;