Merge pull request #2491 from matrix-org/travis/usettings/tab/general

Implement the "General" tab of new user settings
This commit is contained in:
Travis Ralston 2019-01-24 08:51:11 -07:00 committed by GitHub
commit 2a9f6186d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 1355 additions and 168 deletions

View file

@ -637,11 +637,14 @@ module.exports = React.createClass({
// to rebind the onChange each time we render
const onChange = (e) =>
SettingsStore.setValue("autocompleteDelay", null, SettingLevel.DEVICE, e.target.value);
// HACK: Lack of translations for themes header. We're removing this view in the very near future,
// and the header is really only there to maintain some semblance of the UX the section once was.
return (
<div>
<h3>{ _t("User Interface") }</h3>
<div className="mx_UserSettings_section">
{ SIMPLE_SETTINGS.map( this._renderAccountSetting ) }
<div><b>Themes</b></div>
{ THEMES.map( this._renderThemeOption ) }
<table>
<tbody>
@ -676,18 +679,12 @@ module.exports = React.createClass({
},
_renderThemeOption: function(setting) {
const SettingsFlag = sdk.getComponent("elements.SettingsFlag");
const onChange = (v) => dis.dispatch({action: 'set_theme', value: setting.value});
return (
<div className="mx_UserSettings_toggle" key={setting.id + '_' + setting.value}>
<SettingsFlag name="theme"
label={setting.label}
level={SettingLevel.ACCOUNT}
onChange={onChange}
group="theme"
value={setting.value} />
</div>
);
// HACK: Temporary disablement of theme selection.
// We don't support changing themes on experimental anyways, and radio groups aren't
// a thing anymore for setting flags. We're also dropping this view in the very near
// future, so just replace the theme selection with placeholder text.
const currentTheme = SettingsStore.getValue("theme");
return <div>{_t(setting.label)} {currentTheme === setting.value ? '(current)' : null}</div>;
},
_renderCryptoInfo: function() {
@ -1268,9 +1265,7 @@ module.exports = React.createClass({
<ChangePassword
className="mx_UserSettings_accountTable"
rowClassName="mx_UserSettings_profileTableRow"
rowLabelClassName="mx_UserSettings_profileLabelCell"
rowInputClassName="mx_UserSettings_profileInputCell"
buttonClassName="mx_UserSettings_button mx_UserSettings_changePasswordButton"
buttonClassName="mx_UserSettings_button"
onError={this.onPasswordChangeError}
onFinished={this.onPasswordChanged} />
);