mirror of
https://github.com/wassname/talk.git
synced 2026-08-09 12:30:42 +08:00
Adding actions, routes and login popup
This commit is contained in:
@@ -14,6 +14,8 @@ import ModerationContainer from 'containers/ModerationQueue/ModerationContainer'
|
||||
|
||||
import Dashboard from 'containers/Dashboard/Dashboard';
|
||||
|
||||
import SignInContainer from 'coral-sign-in/containers/SignInContainer';
|
||||
|
||||
const routes = (
|
||||
<div>
|
||||
<Route exact path="/admin/install" component={InstallContainer}/>
|
||||
@@ -24,6 +26,7 @@ const routes = (
|
||||
<Route path='stories' component={Stories} />
|
||||
<Route path='dashboard' component={Dashboard} />
|
||||
|
||||
|
||||
{/* Community Routes */}
|
||||
|
||||
<Route path='community' component={CommunityLayout}>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import React from 'react';
|
||||
import {Router, Route, browserHistory} from 'react-router';
|
||||
|
||||
import Embed from './Embed';
|
||||
import SignInContainer from 'coral-sign-in/containers/SignInContainer';
|
||||
|
||||
const routes = (
|
||||
<div>
|
||||
<Route exact path="/embed/stream/login" component={SignInContainer}/>
|
||||
<Route exact path="*" component={Embed}/>
|
||||
</div>
|
||||
);
|
||||
|
||||
const AppRouter = () => <Router history={browserHistory} routes={routes} />;
|
||||
|
||||
export default AppRouter;
|
||||
@@ -8,7 +8,7 @@ const lang = new I18n(translations);
|
||||
|
||||
import {TabBar, Tab, TabContent, Spinner, Button} from 'coral-ui';
|
||||
|
||||
const {logout, showSignInDialog, requestConfirmEmail} = authActions;
|
||||
const {logout, showSignInDialog, requestConfirmEmail, signInPopUp} = authActions;
|
||||
const {addNotification, clearNotification} = notificationActions;
|
||||
const {fetchAssetSuccess} = assetActions;
|
||||
import {NEW_COMMENT_COUNT_POLL_INTERVAL} from 'coral-framework/constants/comments';
|
||||
@@ -126,6 +126,16 @@ class Embed extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
runPopUpLogin = () => {
|
||||
// const newwindow = window.open(
|
||||
// 'http://localhost:3000/embed/stream/login','Login','height=420,width=310,top=200,left=500');
|
||||
// if (window.focus) {
|
||||
// newwindow.focus();
|
||||
// }
|
||||
// return false;
|
||||
this.props.signInPopUp();
|
||||
}
|
||||
|
||||
render () {
|
||||
const {activeTab} = this.state;
|
||||
const {closedAt, countCache = {}} = this.props.asset;
|
||||
@@ -218,10 +228,9 @@ class Embed extends React.Component {
|
||||
</div>
|
||||
: <p>{asset.settings.closedMessage}</p>
|
||||
}
|
||||
{!loggedIn && <SignInContainer
|
||||
requireEmailConfirmation={asset.settings.requireEmailConfirmation}
|
||||
refetch={refetch}
|
||||
offset={signInOffset}/>}
|
||||
|
||||
<Button id='coralSignInButton' onClick={this.runPopUpLogin} full>Sign in to comment</Button>
|
||||
|
||||
{loggedIn && user && <ChangeUsernameContainer loggedIn={loggedIn} offset={signInOffset} user={user} />}
|
||||
{loggedIn && <ModerationLink assetId={asset.id} isAdmin={isAdmin} />}
|
||||
|
||||
@@ -324,6 +333,7 @@ const mapDispatchToProps = dispatch => ({
|
||||
updateCountCache: (id, count) => dispatch(updateCountCache(id, count)),
|
||||
viewAllComments: () => dispatch(viewAllComments()),
|
||||
logout: () => dispatch(logout()),
|
||||
signInPopUp: () => dispatch(signInPopUp()),
|
||||
dispatch: d => dispatch(d),
|
||||
});
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import {ApolloProvider} from 'react-apollo';
|
||||
import {client} from 'coral-framework/services/client';
|
||||
import store from 'coral-framework/services/store';
|
||||
|
||||
import Embed from './Embed';
|
||||
import AppRouter from './AppRouter';
|
||||
|
||||
render(
|
||||
<ApolloProvider client={client} store={store}>
|
||||
<Embed />
|
||||
<AppRouter />
|
||||
</ApolloProvider>
|
||||
, document.querySelector('#coralStream')
|
||||
);
|
||||
|
||||
@@ -83,6 +83,16 @@ export const fetchSignIn = (formData) => (dispatch) => {
|
||||
});
|
||||
};
|
||||
|
||||
// Sign In - Standalone PopUp
|
||||
|
||||
export const signInPopUp = () => () => {
|
||||
window.open(
|
||||
'/embed/stream/login',
|
||||
'Login',
|
||||
'menubar=0,resizable=0,width=500,height=500,top=200,left=500'
|
||||
);
|
||||
};
|
||||
|
||||
// Sign In - Facebook
|
||||
|
||||
const signInFacebookRequest = () => ({type: actions.FETCH_SIGNIN_FACEBOOK_REQUEST});
|
||||
|
||||
@@ -147,8 +147,7 @@ class SignInContainer extends Component {
|
||||
|
||||
handleSignIn(e) {
|
||||
e.preventDefault();
|
||||
this.props.fetchSignIn(this.state.formData)
|
||||
.then(this.props.refetch);
|
||||
this.props.fetchSignIn(this.state.formData);
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -157,11 +156,11 @@ class SignInContainer extends Component {
|
||||
|
||||
return (
|
||||
<div>
|
||||
{!noButton && <Button id='coralSignInButton' onClick={showSignInDialog} full>
|
||||
Sign in to comment
|
||||
</Button>}
|
||||
{/*{!noButton && <Button id='coralSignInButton' onClick={showSignInDialog} full>*/}
|
||||
{/*Sign in to comment*/}
|
||||
{/*</Button>}*/}
|
||||
<SignDialog
|
||||
open={auth.showSignInDialog}
|
||||
open={true}
|
||||
view={auth.view}
|
||||
offset={offset}
|
||||
emailVerificationEnabled={requireEmailConfirmation}
|
||||
|
||||
Reference in New Issue
Block a user