mirror of
https://github.com/wassname/talk.git
synced 2026-07-28 11:27:05 +08:00
WIP
This commit is contained in:
@@ -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} />}
|
||||
|
||||
@@ -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});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user