Adding CommentNotFound Component

This commit is contained in:
okbel
2018-03-22 16:21:13 -03:00
parent b0ea4960e3
commit 61836423ac
2 changed files with 43 additions and 4 deletions
@@ -15,14 +15,13 @@ import QuestionBox from '../../../components/QuestionBox';
import { Tab, TabCount, TabPane } from 'coral-ui';
import cn from 'classnames';
import get from 'lodash/get';
import { reverseCommentParentTree } from '../../../graphql/utils';
import AllCommentsPane from './AllCommentsPane';
import ExtendableTabPanel from '../../../containers/ExtendableTabPanel';
import ChangedUsername from './ChangedUsername';
import CommentNotFound from '../containers/CommentNotFound';
import styles from './Stream.css';
import ChangedUsername from './ChangedUsername';
class Stream extends React.Component {
constructor(props) {
super(props);
@@ -238,7 +237,11 @@ class Stream extends React.Component {
keepCommentBox);
if (highlightedComment === null) {
return <StreamError>{t('stream.comment_not_found')}</StreamError>;
return (
<StreamError>
<CommentNotFound />
</StreamError>
);
}
const slotPassthrough = { root, asset };
@@ -0,0 +1,36 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Button } from 'coral-ui';
import { setActiveTab } from '../../../actions/embed';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import t from 'coral-framework/services/i18n';
class CommentNotFound extends React.Component {
showAllTab = () => {
this.props.setActiveTab('all');
};
render() {
return (
<div>
<p>{t('stream.comment_not_found')}</p>
<Button onClick={this.showAllTab}>Show all comments</Button>
</div>
);
}
}
CommentNotFound.propTypes = {
setActiveTab: PropTypes.func,
};
const mapDispatchToProps = dispatch =>
bindActionCreators(
{
setActiveTab,
},
dispatch
);
export default connect(null, mapDispatchToProps)(CommentNotFound);