Appease the linter
Appease the linter round 2 Appease the linter round 3 Appease the linter round 4 Appease the linter round 5
This commit is contained in:
parent
b678e84272
commit
a488304410
6 changed files with 52 additions and 32 deletions
|
@ -42,9 +42,8 @@ module.exports = {
|
||||||
|
|
||||||
// bind or arrow function in props causes performance issues
|
// bind or arrow function in props causes performance issues
|
||||||
// (but we currently use them in some places)
|
// (but we currently use them in some places)
|
||||||
"react/jsx-no-bind": ["warn", {
|
// It's disabled here, but we should using it sparingly.
|
||||||
"ignoreRefs": true,
|
"react/jsx-no-bind": "off",
|
||||||
}],
|
|
||||||
"react/jsx-key": ["error"],
|
"react/jsx-key": ["error"],
|
||||||
|
|
||||||
// Components in JSX should always be defined.
|
// Components in JSX should always be defined.
|
||||||
|
|
|
@ -610,12 +610,13 @@ export default React.createClass({
|
||||||
case 'view_indexed_room':
|
case 'view_indexed_room':
|
||||||
this._viewIndexedRoom(payload.roomIndex);
|
this._viewIndexedRoom(payload.roomIndex);
|
||||||
break;
|
break;
|
||||||
case 'view_user_settings':
|
case 'view_user_settings': {
|
||||||
const UserSettingsDialog = sdk.getComponent("dialogs.UserSettingsDialog");
|
const UserSettingsDialog = sdk.getComponent("dialogs.UserSettingsDialog");
|
||||||
Modal.createTrackedDialog('User settings', '', UserSettingsDialog, {});
|
Modal.createTrackedDialog('User settings', '', UserSettingsDialog, {});
|
||||||
//this._setPage(PageTypes.UserSettings);
|
//this._setPage(PageTypes.UserSettings);
|
||||||
//this.notifyNewScreen('settings');
|
//this.notifyNewScreen('settings');
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'view_old_user_settings':
|
case 'view_old_user_settings':
|
||||||
this._setPage(PageTypes.UserSettings);
|
this._setPage(PageTypes.UserSettings);
|
||||||
this.notifyNewScreen('settings');
|
this.notifyNewScreen('settings');
|
||||||
|
|
|
@ -81,9 +81,11 @@ export class TabbedView extends React.Component {
|
||||||
tabIcon = <span className="mx_TabbedView_tabLabel_icon">{tab.icon}</span>;
|
tabIcon = <span className="mx_TabbedView_tabLabel_icon">{tab.icon}</span>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const onClickHandler = () => this._setActiveTab(tab);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<span className={classes} key={"tab_label_ " + tab.label}
|
<span className={classes} key={"tab_label_" + tab.label}
|
||||||
onClick={() => this._setActiveTab(tab)}>
|
onClick={onClickHandler}>
|
||||||
{tabIcon}
|
{tabIcon}
|
||||||
<span className="mx_TabbedView_tabLabel_text">
|
<span className="mx_TabbedView_tabLabel_text">
|
||||||
{_t(tab.label)}
|
{_t(tab.label)}
|
||||||
|
|
|
@ -22,8 +22,8 @@ import AccessibleButton from "../elements/AccessibleButton";
|
||||||
import GeneralSettingsTab from "../settings/tabs/GeneralSettingsTab";
|
import GeneralSettingsTab from "../settings/tabs/GeneralSettingsTab";
|
||||||
import dis from '../../../dispatcher';
|
import dis from '../../../dispatcher';
|
||||||
|
|
||||||
|
// TODO: Ditch this whole component
|
||||||
export class TempTab extends React.Component {
|
export class TempTab extends React.Component {
|
||||||
// TODO: Ditch this
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
};
|
};
|
||||||
|
@ -45,13 +45,41 @@ export default class UserSettingsDialog extends React.Component {
|
||||||
|
|
||||||
_getTabs() {
|
_getTabs() {
|
||||||
return [
|
return [
|
||||||
new Tab(_td("General"), <span className="mx_UserSettingsDialog_settingsIcon mx_TabbedView_maskedIcon" />, <GeneralSettingsTab />),
|
new Tab(
|
||||||
new Tab(_td("Notifications"), <span className="mx_UserSettingsDialog_bellIcon mx_TabbedView_maskedIcon" />, <div>Notifications Test</div>),
|
_td("General"),
|
||||||
new Tab(_td("Preferences"), <span className="mx_UserSettingsDialog_preferencesIcon mx_TabbedView_maskedIcon" />, <div>Preferences Test</div>),
|
<span className="mx_UserSettingsDialog_settingsIcon mx_TabbedView_maskedIcon" />,
|
||||||
new Tab(_td("Voice & Video"), <span className="mx_UserSettingsDialog_voiceIcon mx_TabbedView_maskedIcon" />, <div>Voice Test</div>),
|
<GeneralSettingsTab />,
|
||||||
new Tab(_td("Security & Privacy"), <span className="mx_UserSettingsDialog_securityIcon mx_TabbedView_maskedIcon" />, <div>Security Test</div>),
|
),
|
||||||
new Tab(_td("Help & About"), <span className="mx_UserSettingsDialog_helpIcon mx_TabbedView_maskedIcon" />, <div>Help Test</div>),
|
new Tab(
|
||||||
new Tab(_td("Visit old settings"), <span className="mx_UserSettingsDialog_helpIcon mx_TabbedView_maskedIcon" />, <TempTab onClose={this.props.onFinished}/>),
|
_td("Notifications"),
|
||||||
|
<span className="mx_UserSettingsDialog_bellIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<div>Notifications Test</div>,
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
_td("Preferences"),
|
||||||
|
<span className="mx_UserSettingsDialog_preferencesIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<div>Preferences Test</div>,
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
_td("Voice & Video"),
|
||||||
|
<span className="mx_UserSettingsDialog_voiceIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<div>Voice Test</div>,
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
_td("Security & Privacy"),
|
||||||
|
<span className="mx_UserSettingsDialog_securityIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<div>Security Test</div>,
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
_td("Help & About"),
|
||||||
|
<span className="mx_UserSettingsDialog_helpIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<div>Help Test</div>,
|
||||||
|
),
|
||||||
|
new Tab(
|
||||||
|
_td("Visit old settings"),
|
||||||
|
<span className="mx_UserSettingsDialog_helpIcon mx_TabbedView_maskedIcon" />,
|
||||||
|
<TempTab onClose={this.props.onFinished} />,
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,12 +94,6 @@ export default class UserSettingsDialog extends React.Component {
|
||||||
</div>
|
</div>
|
||||||
<TabbedView tabs={this._getTabs()} />
|
<TabbedView tabs={this._getTabs()} />
|
||||||
</div>
|
</div>
|
||||||
// <UserSettings
|
|
||||||
// onClose={this.props.onFinished}
|
|
||||||
// brand={SdkConfig.get().brand}
|
|
||||||
// referralBaseUrl={SdkConfig.get().referralBaseUrl}
|
|
||||||
// teamToken={SdkConfig.get().teamToken}
|
|
||||||
// />
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ export default function AccessibleButton(props) {
|
||||||
// And divs which we report as role button to assistive technologies.
|
// And divs which we report as role button to assistive technologies.
|
||||||
// Browsers handle space and enter keypresses differently and we are only adjusting to the
|
// Browsers handle space and enter keypresses differently and we are only adjusting to the
|
||||||
// inconsistencies here
|
// inconsistencies here
|
||||||
restProps.onKeyDown = function (e) {
|
restProps.onKeyDown = function(e) {
|
||||||
if (e.keyCode === KeyCode.ENTER) {
|
if (e.keyCode === KeyCode.ENTER) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -50,7 +50,7 @@ export default function AccessibleButton(props) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
restProps.onKeyUp = function (e) {
|
restProps.onKeyUp = function(e) {
|
||||||
if (e.keyCode === KeyCode.SPACE) {
|
if (e.keyCode === KeyCode.SPACE) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -21,7 +21,6 @@ import Field from "../../elements/Field";
|
||||||
import AccessibleButton from "../../elements/AccessibleButton";
|
import AccessibleButton from "../../elements/AccessibleButton";
|
||||||
|
|
||||||
export default class GeneralSettingsTab extends React.Component {
|
export default class GeneralSettingsTab extends React.Component {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -56,6 +55,7 @@ export default class GeneralSettingsTab extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
_renderProfileSection() {
|
_renderProfileSection() {
|
||||||
|
// TODO: Ditch avatar placeholder and use the real thing
|
||||||
const form = (
|
const form = (
|
||||||
<form onSubmit={this._saveProfile} autoComplete={false} noValidate={true}>
|
<form onSubmit={this._saveProfile} autoComplete={false} noValidate={true}>
|
||||||
<div className="mx_GeneralSettingsTab_profile">
|
<div className="mx_GeneralSettingsTab_profile">
|
||||||
|
@ -63,24 +63,20 @@ export default class GeneralSettingsTab extends React.Component {
|
||||||
<p className="mx_GeneralSettingsTab_profileUsername">{this.state.userId}</p>
|
<p className="mx_GeneralSettingsTab_profileUsername">{this.state.userId}</p>
|
||||||
<Field id="profileDisplayName" label={_t("Display Name")}
|
<Field id="profileDisplayName" label={_t("Display Name")}
|
||||||
type="text" value={this.state.displayName} autocomplete="off"
|
type="text" value={this.state.displayName} autocomplete="off"
|
||||||
onChange={this._onDisplayNameChanged}
|
onChange={this._onDisplayNameChanged} />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="mx_GeneralSettingsTab_profileAvatar">
|
<div className="mx_GeneralSettingsTab_profileAvatar">
|
||||||
{/*TODO: Ditch avatar placeholder and use the real thing*/}
|
<div />
|
||||||
<div/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<AccessibleButton onClick={this._saveProfile} kind="primary"
|
<AccessibleButton onClick={this._saveProfile} kind="primary"
|
||||||
disabled={!this.state.enableProfileSave}
|
disabled={!this.state.enableProfileSave}>
|
||||||
>
|
|
||||||
{_t("Save")}
|
{_t("Save")}
|
||||||
</AccessibleButton>
|
</AccessibleButton>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (<div className="mx_SettingsTab_section">
|
||||||
<div className="mx_SettingsTab_section">
|
|
||||||
<span className="mx_SettingsTab_subheading">{_t("Profile")}</span>
|
<span className="mx_SettingsTab_subheading">{_t("Profile")}</span>
|
||||||
{form}
|
{form}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue