Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issues with Overlay mode + signUpLink setting on a SPA #650

Merged
merged 2 commits into from
Oct 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/connection/database/login_sign_up_tabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import { showLoginActivity, showSignUpActivity } from './actions';
import * as l from '../../core/index';
import { getScreen } from './index';
import { closeLock } from '../../core/actions';

export default class LoginSignUpTabs extends React.Component {

Expand All @@ -26,6 +27,7 @@ export default class LoginSignUpTabs extends React.Component {
label={signUpLabel}
current={!isLogin}
clickHandler={::this.handleSignUpClick}
clickWithHrefHandler={::this.handleSignUpWithHrefClick}
href={signUpLink}
/>
</ul>
Expand All @@ -38,9 +40,16 @@ export default class LoginSignUpTabs extends React.Component {
}

handleSignUpClick() {
if (this.props.signUpLink) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider the closable property value with this or should we just ignore it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, in this context there are 2 scenarios:

regular webapp: the redirection will change the entire page. It is irrelevant if lock hides or not
spa: changing the route will not force a redirection so lock keeps visible unless it is explicitly hidden (this change).

While implementing lock, you might want it to not be closable (forcing signup or login on a page?) but you will want it to hide if the user is redirected to a different signup page.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok sold

closeLock(l.id(this.props.lock), true);
}
showSignUpActivity(l.id(this.props.lock));
}

handleSignUpWithHrefClick() {
closeLock(l.id(this.props.lock), true);
}

}

LoginSignUpTabs.propTypes = {
Expand All @@ -53,8 +62,12 @@ LoginSignUpTabs.propTypes = {
class LoginSignUpTab extends React.Component {

handleClick(e) {
e.preventDefault();
this.props.clickHandler();
if (this.props.href) {
this.props.clickWithHrefHandler();
} else {
e.preventDefault();
this.props.clickHandler();
}
}

render() {
Expand All @@ -65,7 +78,7 @@ class LoginSignUpTab extends React.Component {
<li className={className}>
<a
href={href || "#"}
onClick={href ? undefined : ::this.handleClick}
onClick={::this.handleClick}
>
{label}
</a>
Expand Down