Merge pull request #2400 from matrix-org/travis/re-apply-exp-changes

Part 3 of 3: Apply today's changes to experimental again
pull/21833/head
Travis Ralston 2019-01-03 16:42:05 -07:00 committed by GitHub
commit 46aa543934
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 72 additions and 12 deletions

View File

@ -186,6 +186,8 @@ $lightbox-border-color: #ffffff;
// unused? // unused?
$progressbar-color: #000; $progressbar-color: #000;
$room-warning-bg-color: #fff8e3;
/*** form elements ***/ /*** form elements ***/
// .mx_textinput is a container for a text input // .mx_textinput is a container for a text input
@ -320,3 +322,11 @@ input[type=search]::-webkit-search-results-decoration {
font-size: 15px; font-size: 15px;
padding: 0px 1.5em 0px 1.5em; padding: 0px 1.5em 0px 1.5em;
} }
@define-mixin mx_DialogButton_secondary {
// flip colours for the secondary ones
font-weight: 600;
border: 1px solid $accent-color ! important;
color: $accent-color;
background-color: $accent-fg-color;
}

View File

@ -91,11 +91,15 @@ class HomePage extends React.Component {
this._unmounted = true; this._unmounted = true;
} }
onLoginClick() { onLoginClick(ev) {
ev.preventDefault();
ev.stopPropagation();
dis.dispatch({ action: 'start_login' }); dis.dispatch({ action: 'start_login' });
} }
onRegisterClick() { onRegisterClick(ev) {
ev.preventDefault();
ev.stopPropagation();
dis.dispatch({ action: 'start_registration' }); dis.dispatch({ action: 'start_registration' });
} }

View File

@ -927,6 +927,10 @@ export default React.createClass({
}, },
_viewHome: function() { _viewHome: function() {
// The home page requires the "logged in" view, so we'll set that.
this.setStateForNewView({
view: VIEWS.LOGGED_IN,
});
this._setPage(PageTypes.HomePage); this._setPage(PageTypes.HomePage);
this.notifyNewScreen('home'); this.notifyNewScreen('home');
}, },
@ -1183,10 +1187,7 @@ export default React.createClass({
* @param {string} teamToken * @param {string} teamToken
*/ */
_onLoggedIn: async function(teamToken) { _onLoggedIn: async function(teamToken) {
this.setState({ this.setStateForNewView({view: VIEWS.LOGGED_IN});
view: VIEWS.LOGGED_IN,
});
if (teamToken) { if (teamToken) {
// A team member has logged in, not a guest // A team member has logged in, not a guest
this._teamToken = teamToken; this._teamToken = teamToken;

View File

@ -162,6 +162,18 @@ module.exports = React.createClass({
this.setState(newState); this.setState(newState);
}, },
onLoginClick: function(ev) {
ev.preventDefault();
ev.stopPropagation();
this.props.onLoginClick();
},
onRegisterClick: function(ev) {
ev.preventDefault();
ev.stopPropagation();
this.props.onRegisterClick();
},
showErrorDialog: function(body, title) { showErrorDialog: function(body, title) {
const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog"); const ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
Modal.createTrackedDialog('Forgot Password Error', '', ErrorDialog, { Modal.createTrackedDialog('Forgot Password Error', '', ErrorDialog, {
@ -253,10 +265,10 @@ module.exports = React.createClass({
</form> </form>
{ serverConfigSection } { serverConfigSection }
{ errorText } { errorText }
<a className="mx_Login_create" onClick={this.props.onLoginClick} href="#"> <a className="mx_Login_create" onClick={this.onLoginClick} href="#">
{ _t('Return to login screen') } { _t('Return to login screen') }
</a> </a>
<a className="mx_Login_create" onClick={this.props.onRegisterClick} href="#"> <a className="mx_Login_create" onClick={this.onRegisterClick} href="#">
{ _t('Create an account') } { _t('Create an account') }
</a> </a>
<LanguageSelector /> <LanguageSelector />

View File

@ -214,7 +214,10 @@ module.exports = React.createClass({
}).done(); }).done();
}, },
_onLoginAsGuestClick: function() { _onLoginAsGuestClick: function(ev) {
ev.preventDefault();
ev.stopPropagation();
const self = this; const self = this;
self.setState({ self.setState({
busy: true, busy: true,
@ -297,6 +300,12 @@ module.exports = React.createClass({
}); });
}, },
onRegisterClick: function(ev) {
ev.preventDefault();
ev.stopPropagation();
this.props.onRegisterClick();
},
_tryWellKnownDiscovery: async function(serverName) { _tryWellKnownDiscovery: async function(serverName) {
if (!serverName.trim()) { if (!serverName.trim()) {
// Nothing to discover // Nothing to discover
@ -567,7 +576,7 @@ module.exports = React.createClass({
{ errorTextSection } { errorTextSection }
{ this.componentForStep(this.state.currentFlow) } { this.componentForStep(this.state.currentFlow) }
{ serverConfig } { serverConfig }
<a className="mx_Login_create" onClick={this.props.onRegisterClick} href="#"> <a className="mx_Login_create" onClick={this.onRegisterClick} href="#">
{ _t('Create an account') } { _t('Create an account') }
</a> </a>
{ loginAsGuestJsx } { loginAsGuestJsx }

View File

@ -363,6 +363,12 @@ module.exports = React.createClass({
} }
}, },
onLoginClick: function(ev) {
ev.preventDefault();
ev.stopPropagation();
this.props.onLoginClick();
},
_makeRegisterRequest: function(auth) { _makeRegisterRequest: function(auth) {
// Only send the bind params if we're sending username / pw params // Only send the bind params if we're sending username / pw params
// (Since we need to send no params at all to use the ones saved in the // (Since we need to send no params at all to use the ones saved in the
@ -468,7 +474,7 @@ module.exports = React.createClass({
let signIn; let signIn;
if (!this.state.doingUIAuth) { if (!this.state.doingUIAuth) {
signIn = ( signIn = (
<a className="mx_Login_create" onClick={this.props.onLoginClick} href="#"> <a className="mx_Login_create" onClick={this.onLoginClick} href="#">
{ theme === 'status' ? _t('Sign in') : _t('I already have an account') } { theme === 'status' ? _t('Sign in') : _t('I already have an account') }
</a> </a>
); );

View File

@ -86,6 +86,7 @@ module.exports = React.createClass({
incomingCallTag: null, incomingCallTag: null,
incomingCall: null, incomingCall: null,
selectedTags: [], selectedTags: [],
hover: false,
}; };
}, },
@ -294,6 +295,17 @@ module.exports = React.createClass({
this.forceUpdate(); this.forceUpdate();
}, },
onMouseEnter: function(ev) {
this.setState({hover: true});
},
onMouseLeave: function(ev) {
this.setState({hover: false});
// Refresh the room list just in case the user missed something.
this._delayedRefreshRoomList();
},
_delayedRefreshRoomList: new rate_limited_func(function() { _delayedRefreshRoomList: new rate_limited_func(function() {
this.refreshRoomList(); this.refreshRoomList();
}, 500), }, 500),
@ -346,6 +358,11 @@ module.exports = React.createClass({
}, },
refreshRoomList: function() { refreshRoomList: function() {
if (this.state.hover) {
// Don't re-sort the list if we're hovering over the list
return;
}
// TODO: ideally we'd calculate this once at start, and then maintain // TODO: ideally we'd calculate this once at start, and then maintain
// any changes to it incrementally, updating the appropriate sublists // any changes to it incrementally, updating the appropriate sublists
// as needed. // as needed.
@ -693,7 +710,8 @@ module.exports = React.createClass({
const subListComponents = this._mapSubListProps(subLists); const subListComponents = this._mapSubListProps(subLists);
return ( return (
<div ref={this._collectResizeContainer} className="mx_RoomList"> <div ref={this._collectResizeContainer} className="mx_RoomList"
onMouseEnter={this.onMouseEnter} onMouseLeave={this.onMouseLeave}>
{ subListComponents } { subListComponents }
</div> </div>
); );