replace some of the status.im theme with general config options

This commit is contained in:
Matthew Hodgson 2017-11-11 23:46:43 +00:00
parent a0cdaf29f9
commit 2827bc0718
7 changed files with 37 additions and 24 deletions

View file

@ -24,6 +24,7 @@ module.exports = React.createClass({
displayName: 'LoginPage',
render: function() {
// FIXME: this should be turned into a proper skin with a StatusLoginPage component
if (UserSettingsStore.getTheme() === 'status') {
return (
<div className="mx_StatusLogin">

View file

@ -20,7 +20,7 @@ import classNames from 'classnames';
import sdk from '../../../index';
import { _t } from '../../../languageHandler';
import {field_input_incorrect} from '../../../UiEffects';
import UserSettingsStore from '../../../UserSettingsStore';
import SdkConfig from '../../../SdkConfig';
/**
* A pure UI component which displays a username/password form.
@ -122,8 +122,6 @@ class PasswordLogin extends React.Component {
mx_Login_field_disabled: disabled,
};
const theme = UserSettingsStore.getTheme();
switch(loginType) {
case PasswordLogin.LOGIN_FIELD_EMAIL:
classes.mx_Login_email = true;
@ -146,7 +144,10 @@ class PasswordLogin extends React.Component {
type="text"
name="username" // make it a little easier for browser's remember-password
onChange={this.onUsernameChanged}
placeholder={theme === 'status' ? "Username on matrix.status.im" : _t("User name")}
placeholder={ SdkConfig.get().disable_custom_urls ?
_t("Username on %(hs)s", {
hs: this.props.hsUrl.replace(/^https?:\/\//, '')
}) : _t("User name")}
value={this.state.username}
autoFocus
disabled={disabled}
@ -212,9 +213,8 @@ class PasswordLogin extends React.Component {
const loginField = this.renderLoginField(this.state.loginType, matrixIdText === '');
const theme = UserSettingsStore.getTheme();
let loginType;
if (theme !== 'status') {
if (!SdkConfig.get().disable_3pid_login) {
loginType = (
<div className="mx_Login_type_container">
<label className="mx_Login_type_label">{ _t('Sign in with') }</label>

View file

@ -23,6 +23,7 @@ import { looksValid as phoneNumberLooksValid } from '../../../phonenumber';
import Modal from '../../../Modal';
import { _t } from '../../../languageHandler';
import UserSettingsStore from '../../../UserSettingsStore';
import SdkConfig from '../../../SdkConfig';
const FIELD_EMAIL = 'field_email';
const FIELD_PHONE_COUNTRY = 'field_phone_country';
@ -275,6 +276,7 @@ module.exports = React.createClass({
const self = this;
const theme = UserSettingsStore.getTheme();
// FIXME: remove hardcoded Status team tweaks at some point
const emailPlaceholder = theme === 'status' ? _t("Email address") : _t("Email address (optional)");
const emailSection = (
@ -311,7 +313,7 @@ module.exports = React.createClass({
const CountryDropdown = sdk.getComponent('views.login.CountryDropdown');
let phoneSection;
if (theme !== "status") {
if (!SdkConfig.get().disable_3pid_login) {
phoneSection = (
<div className="mx_Login_phoneSection">
<CountryDropdown ref="phone_country" onOptionChange={this._onPhoneCountryChange}