This commit is contained in:
Chi Vinh Le
2017-04-20 21:30:24 +07:00
parent 348c01ae80
commit b12d4ef4a2
2 changed files with 24 additions and 14 deletions
+1 -11
View File
@@ -126,16 +126,6 @@ class Embed extends React.Component {
}
}
signIn = () => {
const {refetch} = this.props.data;
const {openSignInPopUp, checkLogin} = this.props;
openSignInPopUp(() => {
checkLogin();
refetch();
});
}
render () {
const {activeTab} = this.state;
const {closedAt, countCache = {}} = this.props.asset;
@@ -229,7 +219,7 @@ class Embed extends React.Component {
: <p>{asset.settings.closedMessage}</p>
}
{!loggedIn && <Button id='coralSignInButton' onClick={this.signIn} full>Sign in to comment</Button>}
{!loggedIn && <Button id='coralSignInButton' onClick={this.showSignInDialog} full>Sign in to comment</Button>}
{loggedIn && user && <ChangeUsernameContainer loggedIn={loggedIn} offset={signInOffset} user={user} />}
{loggedIn && <ModerationLink assetId={asset.id} isAdmin={isAdmin} />}
+23 -3
View File
@@ -22,8 +22,20 @@ function fetchMe() {
}
// Dialog Actions
export const showSignInDialog = (offset = 0) => ({type: actions.SHOW_SIGNIN_DIALOG, offset});
export const hideSignInDialog = () => ({type: actions.HIDE_SIGNIN_DIALOG});
export const showSignInDialog = () => dispatch => {
const signInPopUp = window.open(
'/embed/stream/login',
'Login',
'menubar=0,resizable=0,width=500,height=500,top=200,left=500'
);
signInPopUp.onbeforeunload = fetchMe;
// ({type: actions.SHOW_SIGNIN_DIALOG, offset})
};
export const hideSignInDialog = () => dispatch => {
window.close();
// ({type: actions.HIDE_SIGNIN_DIALOG});
}
export const createUsernameRequest = () => ({type: actions.CREATE_USERNAME_REQUEST});
export const showCreateUsernameDialog = () => ({type: actions.SHOW_CREATEUSERNAME_DIALOG});
@@ -47,11 +59,19 @@ export const createUsername = (userId, formData) => dispatch => {
});
};
export const changeView = view => dispatch =>
export const changeView = view => dispatch => {
switch(view) {
case 'SIGNUP':
window.resizeTo(500, 700);
break;
default:
window.resizeTo(500, 500);
}
dispatch({
type: actions.CHANGE_VIEW,
view
});
};
export const cleanState = () => ({type: actions.CLEAN_STATE});