From c2fbbf1bcb3fb3385e0b29df96d77a677f8c3017 Mon Sep 17 00:00:00 2001 From: Qolzam Date: Mon, 5 Feb 2018 10:57:14 +0700 Subject: [PATCH] [Resolved] Avoid showing header avatar on notification box & resolve unique key error in stream component --- src/components/notify/NotifyComponent.tsx | 5 +- src/components/stream/StreamComponent.tsx | 90 +++++++++++------------ tslint.json | 3 +- 3 files changed, 50 insertions(+), 48 deletions(-) diff --git a/src/components/notify/NotifyComponent.tsx b/src/components/notify/NotifyComponent.tsx index ef63635..6b94b05 100644 --- a/src/components/notify/NotifyComponent.tsx +++ b/src/components/notify/NotifyComponent.tsx @@ -39,6 +39,9 @@ const styles = (theme: any) => ({ }, popperClose: { pointerEvents: 'none' + }, + popperOpen: { + zIndex: 1 } }) @@ -121,7 +124,7 @@ export class NotifyComponent extends Component diff --git a/src/components/stream/StreamComponent.tsx b/src/components/stream/StreamComponent.tsx index aff9bf5..c4aef0f 100644 --- a/src/components/stream/StreamComponent.tsx +++ b/src/components/stream/StreamComponent.tsx @@ -4,7 +4,7 @@ import { withRouter } from 'react-router-dom' import { connect } from 'react-redux' import PropTypes from 'prop-types' import Button from 'material-ui/Button' -import { grey,teal } from 'material-ui/colors' +import { grey, teal } from 'material-ui/colors' import SvgCamera from 'material-ui-icons/PhotoCamera' import Paper from 'material-ui/Paper' import List, { ListItem, ListItemIcon, ListItemText } from 'material-ui/List' @@ -27,7 +27,7 @@ import { IStreamComponentState } from './IStreamComponentState' import { Post } from 'core/domain/posts' // - Create StreamComponent component class -export class StreamComponent extends Component { +export class StreamComponent extends Component { static propTypes = { /** @@ -47,11 +47,11 @@ export class StreamComponent extends Component { - let { posts ,match } = this.props - let {tag} = match.params + let { posts, match } = this.props + let { tag } = match.params if (posts === undefined || !(Object.keys(posts).length > 0)) { return ( @@ -144,13 +144,13 @@ export class StreamComponent extends Component { if (tag) { - let regex = new RegExp('#' + tag,'g') + let regex = new RegExp('#' + tag, 'g') let postMatch = posts[postId].body!.match(regex) if (postMatch !== null) { - parsedPosts.push({ ...posts[postId]}) + parsedPosts.push({ ...posts[postId] }) } } else { - parsedPosts.push({ ...posts[postId]}) + parsedPosts.push({ ...posts[postId] }) } }) @@ -161,13 +161,13 @@ export class StreamComponent extends Component { + sortedPosts.forEach((post: Post, index: any) => { let newPost: any = ( -
+
{index > 1 || (!postBack.divided && index > 0) ?
: ''} - +
) @@ -187,12 +187,12 @@ export class StreamComponent extends Component { - const {loadStream} = this.props + const { loadStream } = this.props loadStream!(page, 10) } - componentWillMount () { - const {setHomeTitle} = this.props + componentWillMount() { + const { setHomeTitle } = this.props setHomeTitle!() } @@ -200,38 +200,38 @@ export class StreamComponent extends Component} - > + pageStart={0} + loadMore={this.scrollLoad} + hasMore={hasMorePosts} + useWindow={true} + loader={} + >
-
+
{displayWriting && !tag - ? ( - + ? ( + - + - What's new with you? } /> + What's new with you? } /> - - - + + + - -
+
+
) : ''} @@ -239,7 +239,7 @@ export class StreamComponent extends Component
{postList.divided - ? (
+ ? (
{postList.oddPostList}
@@ -249,7 +249,7 @@ export class StreamComponent extends Component - + ) } } @@ -276,7 +276,7 @@ const mapDispatchToProps = (dispatch: any, ownProps: IStreamComponentProps) => { * @return {object} props of component */ const mapStateToProps = (state: any, ownProps: IStreamComponentProps) => { - const {post} = state + const { post } = state return { avatar: state.user.info && state.user.info[state.authorize.uid] ? state.user.info[state.authorize.uid].avatar : '', fullName: state.user.info && state.user.info[state.authorize.uid] ? state.user.info[state.authorize.uid].fullName : '' diff --git a/tslint.json b/tslint.json index 477729a..ee9aaa1 100644 --- a/tslint.json +++ b/tslint.json @@ -41,8 +41,7 @@ "debug", "info", "time", - "timeEnd", - "trace" + "timeEnd" ], "no-consecutive-blank-lines": true, "no-construct": true,