Merge pull request #2472 from matrix-org/dbkr/delint_compatpage_loggedinview

De-lint CompatabilityPage & LoggedInView
This commit is contained in:
David Baker 2019-01-22 10:23:23 +00:00 committed by GitHub
commit 49cc9f4b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 20 deletions

View File

@ -3,9 +3,7 @@
src/component-index.js src/component-index.js
src/components/structures/auth/ForgotPassword.js src/components/structures/auth/ForgotPassword.js
src/components/structures/BottomLeftMenu.js src/components/structures/BottomLeftMenu.js
src/components/structures/CompatibilityPage.js
src/components/structures/CreateRoom.js src/components/structures/CreateRoom.js
src/components/structures/LoggedInView.js
src/components/structures/MessagePanel.js src/components/structures/MessagePanel.js
src/components/structures/NotificationPanel.js src/components/structures/NotificationPanel.js
src/components/structures/RoomDirectory.js src/components/structures/RoomDirectory.js

View File

@ -41,10 +41,15 @@ module.exports = React.createClass({
<div className="mx_CompatibilityPage_box"> <div className="mx_CompatibilityPage_box">
<p>{ _t("Sorry, your browser is <b>not</b> able to run Riot.", {}, { 'b': (sub) => <b>{sub}</b> }) } </p> <p>{ _t("Sorry, your browser is <b>not</b> able to run Riot.", {}, { 'b': (sub) => <b>{sub}</b> }) } </p>
<p> <p>
{ _t("Riot uses many advanced browser features, some of which are not available or experimental in your current browser.") } { _t(
"Riot uses many advanced browser features, some of which are not available " +
"or experimental in your current browser.",
) }
</p> </p>
<p> <p>
{ _t('Please install <chromeLink>Chrome</chromeLink> or <firefoxLink>Firefox</firefoxLink> for the best experience.', { _t(
'Please install <chromeLink>Chrome</chromeLink> or <firefoxLink>Firefox</firefoxLink> ' +
'for the best experience.',
{}, {},
{ {
'chromeLink': (sub) => <a href="https://www.google.com/chrome">{sub}</a>, 'chromeLink': (sub) => <a href="https://www.google.com/chrome">{sub}</a>,
@ -60,7 +65,12 @@ module.exports = React.createClass({
)} )}
</p> </p>
<p> <p>
{ _t("With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!") } { _t(
"With your current browser, the look and feel of the application may be " +
"completely incorrect, and some or all features may not function. " +
"If you want to try it anyway you can continue, but you are on your own in terms " +
"of any issues you may encounter!",
) }
</p> </p>
<button onClick={this.onAccept}> <button onClick={this.onAccept}>
{ _t("I understand the risks and wish to continue") } { _t("I understand the risks and wish to continue") }

View File

@ -35,7 +35,7 @@ import RoomListStore from "../../stores/RoomListStore";
import TagOrderActions from '../../actions/TagOrderActions'; import TagOrderActions from '../../actions/TagOrderActions';
import RoomListActions from '../../actions/RoomListActions'; import RoomListActions from '../../actions/RoomListActions';
import ResizeHandle from '../views/elements/ResizeHandle'; import ResizeHandle from '../views/elements/ResizeHandle';
import {Resizer, CollapseDistributor} from '../../resizer' import {Resizer, CollapseDistributor} from '../../resizer';
// We need to fetch each pinned message individually (if we don't already have it) // We need to fetch each pinned message individually (if we don't already have it)
// so each pinned message may trigger a request. Limit the number per room for sanity. // so each pinned message may trigger a request. Limit the number per room for sanity.
// NB. this is just for server notices rather than pinned messages in general. // NB. this is just for server notices rather than pinned messages in general.
@ -160,7 +160,7 @@ const LoggedInView = React.createClass({
const classNames = { const classNames = {
handle: "mx_ResizeHandle", handle: "mx_ResizeHandle",
vertical: "mx_ResizeHandle_vertical", vertical: "mx_ResizeHandle_vertical",
reverse: "mx_ResizeHandle_reverse" reverse: "mx_ResizeHandle_reverse",
}; };
const collapseConfig = { const collapseConfig = {
toggleSize: 260 - 50, toggleSize: 260 - 50,
@ -201,7 +201,11 @@ const LoggedInView = React.createClass({
}, },
onSync: function(syncState, oldSyncState, data) { onSync: function(syncState, oldSyncState, data) {
const oldErrCode = this.state.syncErrorData && this.state.syncErrorData.error && this.state.syncErrorData.error.errcode; const oldErrCode = (
this.state.syncErrorData &&
this.state.syncErrorData.error &&
this.state.syncErrorData.error.errcode
);
const newErrCode = data && data.error && data.error.errcode; const newErrCode = data && data.error && data.error.errcode;
if (syncState === oldSyncState && oldErrCode === newErrCode) return; if (syncState === oldSyncState && oldErrCode === newErrCode) return;
@ -310,7 +314,10 @@ const LoggedInView = React.createClass({
} }
}, },
/** dispatch a page-up/page-down/etc to the appropriate component */ /**
* dispatch a page-up/page-down/etc to the appropriate component
* @param {Object} ev The key event
*/
_onScrollKeyPressed: function(ev) { _onScrollKeyPressed: function(ev) {
if (this.refs.roomView) { if (this.refs.roomView) {
this.refs.roomView.handleScrollKey(ev); this.refs.roomView.handleScrollKey(ev);
@ -424,11 +431,11 @@ const LoggedInView = React.createClass({
const PasswordNagBar = sdk.getComponent('globals.PasswordNagBar'); const PasswordNagBar = sdk.getComponent('globals.PasswordNagBar');
const ServerLimitBar = sdk.getComponent('globals.ServerLimitBar'); const ServerLimitBar = sdk.getComponent('globals.ServerLimitBar');
let page_element; let pageElement;
switch (this.props.page_type) { switch (this.props.page_type) {
case PageTypes.RoomView: case PageTypes.RoomView:
page_element = <RoomView pageElement = <RoomView
ref='roomView' ref='roomView'
autoJoin={this.props.autoJoin} autoJoin={this.props.autoJoin}
onRegistered={this.props.onRegistered} onRegistered={this.props.onRegistered}
@ -444,7 +451,7 @@ const LoggedInView = React.createClass({
break; break;
case PageTypes.UserSettings: case PageTypes.UserSettings:
page_element = <UserSettings pageElement = <UserSettings
onClose={this.props.onCloseAllSettings} onClose={this.props.onCloseAllSettings}
brand={this.props.config.brand} brand={this.props.config.brand}
referralBaseUrl={this.props.config.referralBaseUrl} referralBaseUrl={this.props.config.referralBaseUrl}
@ -453,11 +460,11 @@ const LoggedInView = React.createClass({
break; break;
case PageTypes.MyGroups: case PageTypes.MyGroups:
page_element = <MyGroups />; pageElement = <MyGroups />;
break; break;
case PageTypes.RoomDirectory: case PageTypes.RoomDirectory:
page_element = <RoomDirectory pageElement = <RoomDirectory
ref="roomDirectory" ref="roomDirectory"
config={this.props.config.roomDirectory} config={this.props.config.roomDirectory}
/>; />;
@ -471,7 +478,7 @@ const LoggedInView = React.createClass({
const teamServerUrl = this.props.config.teamServerConfig ? const teamServerUrl = this.props.config.teamServerConfig ?
this.props.config.teamServerConfig.teamServerURL : null; this.props.config.teamServerConfig.teamServerURL : null;
page_element = <HomePage pageElement = <HomePage
teamServerUrl={teamServerUrl} teamServerUrl={teamServerUrl}
teamToken={this.props.teamToken} teamToken={this.props.teamToken}
homePageUrl={this.props.config.welcomePageUrl} homePageUrl={this.props.config.welcomePageUrl}
@ -480,12 +487,12 @@ const LoggedInView = React.createClass({
break; break;
case PageTypes.UserView: case PageTypes.UserView:
page_element = null; // deliberately null for now pageElement = null; // deliberately null for now
// TODO: fix/remove UserView // TODO: fix/remove UserView
// right_panel = <RightPanel disabled={this.props.rightDisabled} />; // right_panel = <RightPanel disabled={this.props.rightDisabled} />;
break; break;
case PageTypes.GroupView: case PageTypes.GroupView:
page_element = <GroupView pageElement = <GroupView
groupId={this.props.currentGroupId} groupId={this.props.currentGroupId}
isNew={this.props.currentGroupIsNew} isNew={this.props.currentGroupIsNew}
collapsedRhs={this.props.collapsedRhs} collapsedRhs={this.props.collapsedRhs}
@ -525,7 +532,10 @@ const LoggedInView = React.createClass({
topBar = <UpdateCheckBar {...this.props.checkingForUpdate} />; topBar = <UpdateCheckBar {...this.props.checkingForUpdate} />;
} else if (this.state.userHasGeneratedPassword) { } else if (this.state.userHasGeneratedPassword) {
topBar = <PasswordNagBar />; topBar = <PasswordNagBar />;
} else if (!isGuest && Notifier.supportsDesktopNotifications() && !Notifier.isEnabled() && !Notifier.isToolbarHidden()) { } else if (
!isGuest && Notifier.supportsDesktopNotifications() &&
!Notifier.isEnabled() && !Notifier.isToolbarHidden()
) {
topBar = <MatrixToolbar />; topBar = <MatrixToolbar />;
} }
@ -547,7 +557,7 @@ const LoggedInView = React.createClass({
disabled={this.props.leftDisabled} disabled={this.props.leftDisabled}
/> />
<ResizeHandle /> <ResizeHandle />
{ page_element } { pageElement }
</div> </div>
</DragDropContext> </DragDropContext>
</div> </div>