SignInButton

This commit is contained in:
Belen Curcio
2017-05-19 19:29:50 -03:00
parent 3af49de0ce
commit dbfd2aff7c
5 changed files with 18 additions and 19 deletions
@@ -1,7 +1,6 @@
import React from 'react';
const lang = new I18n(translations);
import Stream from '../containers/Stream';
import Slot from 'coral-framework/components/Slot';
import I18n from 'coral-framework/modules/i18n/i18n';
import UserBox from 'coral-sign-in/components/UserBox';
import translations from 'coral-framework/translations';
@@ -1,6 +1,4 @@
import React, {PropTypes} from 'react';
import {Button} from 'coral-ui';
import LoadMore from './LoadMore';
import NewCount from './NewCount';
import Comment from '../containers/Comment';
@@ -16,7 +14,7 @@ import ChangeUsernameContainer
from 'coral-sign-in/containers/ChangeUsernameContainer';
class Stream extends React.Component {
setActiveReplyBox = reactKey => {
setActiveReplyBox = (reactKey) => {
if (!this.props.auth.user) {
this.props.showSignInDialog();
} else {
@@ -59,11 +57,11 @@ class Stream extends React.Component {
const firstCommentDate = asset.comments[0]
? asset.comments[0].created_at
: new Date(Date.now() - 1000 * 60 * 60 * 24 * 7).toISOString();
const commentIsIgnored = comment => {
const commentIsIgnored = (comment) => {
return (
me &&
me.ignoredUsers &&
me.ignoredUsers.find(u => u.id === comment.user.id)
me.ignoredUsers.find((u) => u.id === comment.user.id)
);
};
return (
@@ -151,7 +149,7 @@ class Stream extends React.Component {
setCommentCountCache={this.props.setCommentCountCache}
/>
<div className="embed__stream">
{comments.map(comment => {
{comments.map((comment) => {
return commentIsIgnored(comment)
? <IgnoredCommentTombstone key={comment.id} />
: <Comment
@@ -3,4 +3,4 @@ import Slot from 'coral-framework/components/Slot';
export const LoginContainer = () => (
<Slot fill="login"/>
)
);
@@ -2,4 +2,4 @@ import React from 'react';
export const SignInContainer = () => (
<Slot fill="login"/>
)
);
@@ -4,17 +4,19 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {showSignInDialog} from 'coral-framework/actions/auth';
class SignInButton extends React.Component {
render() {
return (
<Button id="coralSignInButton" onClick={this.props.showSignInDialog} full>
Sign in to comment
</Button>
);
}
}
const SignInButton = ({loggedIn, showSignInDialog}) => (
<div>
{
!loggedIn ? (
<Button id="coralSignInButton" onClick={showSignInDialog} full>
Sign in to comment
</Button>
) : null
}
</div>
);
const mapStateToProps = ({auth}) => ({auth});
const mapStateToProps = ({auth}) => ({loggedIn: auth.loggedIn});
const mapDispatchToProps = dispatch =>
bindActionCreators({showSignInDialog}, dispatch);