use JSX and import via sdk rather than directly

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2018-06-22 14:47:57 +01:00
parent f32da97a3a
commit 548a06cad2
No known key found for this signature in database
GPG key ID: 3F879DA5AD802A5E
4 changed files with 10 additions and 7 deletions

View file

@ -24,7 +24,6 @@ import MatrixClientPeg from "../../../MatrixClientPeg";
import SdkConfig from "../../../SdkConfig"; import SdkConfig from "../../../SdkConfig";
import PasswordReset from "../../../PasswordReset"; import PasswordReset from "../../../PasswordReset";
import makeLanguageSelector from "./LanguageSelector";
module.exports = React.createClass({ module.exports = React.createClass({
displayName: 'ForgotPassword', displayName: 'ForgotPassword',
@ -202,6 +201,8 @@ module.exports = React.createClass({
); );
} }
const LanguageSelector = sdk.getComponent('structures.login.LanguageSelector');
resetPasswordJsx = ( resetPasswordJsx = (
<div> <div>
<div className="mx_Login_prompt"> <div className="mx_Login_prompt">
@ -236,7 +237,7 @@ module.exports = React.createClass({
<a className="mx_Login_create" onClick={this.props.onRegisterClick} href="#"> <a className="mx_Login_create" onClick={this.props.onRegisterClick} href="#">
{ _t('Create an account') } { _t('Create an account') }
</a> </a>
{ makeLanguageSelector() } <LanguageSelector />
<LoginFooter /> <LoginFooter />
</div> </div>
</div> </div>

View file

@ -28,7 +28,7 @@ function onChange(newLang) {
} }
} }
export default function makeLanguageSelector() { export default function LanguageSelector() {
if (SdkConfig.get()['disable_login_language_selector']) return <div />; if (SdkConfig.get()['disable_login_language_selector']) return <div />;
const LanguageDropdown = sdk.getComponent('views.elements.LanguageDropdown'); const LanguageDropdown = sdk.getComponent('views.elements.LanguageDropdown');

View file

@ -25,7 +25,6 @@ import sdk from '../../../index';
import Login from '../../../Login'; import Login from '../../../Login';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import makeLanguageSelector from "./LanguageSelector";
// For validating phone numbers without country codes // For validating phone numbers without country codes
const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/; const PHONE_NUMBER_REGEX = /^[0-9()\-\s]*$/;
@ -427,6 +426,8 @@ module.exports = React.createClass({
); );
} }
const LanguageSelector = sdk.getComponent('structures.login.LanguageSelector');
return ( return (
<LoginPage> <LoginPage>
<div className="mx_Login_box"> <div className="mx_Login_box">
@ -440,7 +441,7 @@ module.exports = React.createClass({
{ _t('Create an account') } { _t('Create an account') }
</a> </a>
{ loginAsGuestJsx } { loginAsGuestJsx }
{ makeLanguageSelector() } <LanguageSelector />
<LoginFooter /> <LoginFooter />
</div> </div>
</div> </div>

View file

@ -29,7 +29,6 @@ import RtsClient from '../../../RtsClient';
import { _t } from '../../../languageHandler'; import { _t } from '../../../languageHandler';
import SdkConfig from '../../../SdkConfig'; import SdkConfig from '../../../SdkConfig';
import SettingsStore from "../../../settings/SettingsStore"; import SettingsStore from "../../../settings/SettingsStore";
import makeLanguageSelector from "./LanguageSelector";
const MIN_PASSWORD_LENGTH = 6; const MIN_PASSWORD_LENGTH = 6;
@ -413,6 +412,8 @@ module.exports = React.createClass({
); );
} }
const LanguageSelector = sdk.getComponent('structures.login.LanguageSelector');
return ( return (
<LoginPage> <LoginPage>
<div className="mx_Login_box"> <div className="mx_Login_box">
@ -426,7 +427,7 @@ module.exports = React.createClass({
{ registerBody } { registerBody }
{ signIn } { signIn }
{ errorText } { errorText }
{ makeLanguageSelector() } <LanguageSelector />
<LoginFooter /> <LoginFooter />
</div> </div>
</LoginPage> </LoginPage>