mirror of
https://github.com/wassname/talk.git
synced 2026-07-31 12:50:48 +08:00
Adding CommentNotFound Component
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user