From 8bc6a0cb1443ba782ea4844e916605e8a294973f Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 13 Mar 2017 13:51:20 -0300 Subject: [PATCH] PLT-5726 Fix post profile picture tap (#345) * PLT-5726 Fix post user image tap * Fix double loading showing up * conditional reply bar --- app/components/post/post.js | 50 +++++++-------- .../profile_picture/profile_picture.js | 64 +++++++++---------- app/scenes/load_team/load_team.js | 6 +- 3 files changed, 56 insertions(+), 64 deletions(-) diff --git a/app/components/post/post.js b/app/components/post/post.js index c0d9c6cad..908bddded 100644 --- a/app/components/post/post.js +++ b/app/components/post/post.js @@ -43,7 +43,7 @@ export default class Post extends Component { if (this.props.onPress) { this.props.onPress(this.props.post); } - } + }; renderCommentedOnMessage = (style) => { if (!this.props.renderReplies || !this.props.commentedOnPost) { @@ -100,7 +100,7 @@ export default class Post extends Component { } return ; - } + }; renderFileAttachments() { const {post} = this.props; @@ -114,7 +114,23 @@ export default class Post extends Component { viewUserProfile = () => { this.props.actions.goToUserProfile(this.props.user.id); - } + }; + + renderMessage = (style, messageStyle, replyBar = false) => { + return ( + + + {replyBar && this.renderReplyBar(style)} + {this.props.post.message.length > 0 && + + {this.props.post.message} + + } + {this.renderFileAttachments()} + + + ); + }; render() { const style = getStyleSheet(this.props.theme); @@ -211,15 +227,7 @@ export default class Post extends Component { {this.renderCommentedOnMessage(style)} - - {this.renderReplyBar(style)} - {this.props.post.message.length > 0 && - - {this.props.post.message} - - } - {this.renderFileAttachments()} - + {this.renderMessage(style, messageStyle, true)} ); @@ -238,30 +246,16 @@ export default class Post extends Component { - - {this.props.post.message.length > 0 && - - {this.props.post.message} - - } - {this.renderFileAttachments()} - + {this.renderMessage(style, messageStyle)} ); } - if (this.props.onPress) { - return ( - - {contents} - - ); - } - return contents; } + } const getStyleSheet = makeStyleSheetFromTheme((theme) => { diff --git a/app/components/profile_picture/profile_picture.js b/app/components/profile_picture/profile_picture.js index c070d2538..85398d787 100644 --- a/app/components/profile_picture/profile_picture.js +++ b/app/components/profile_picture/profile_picture.js @@ -11,38 +11,6 @@ import placeholder from 'assets/images/profile.jpg'; import Client from 'service/client'; -const getStyleSheet = makeStyleSheetFromTheme((theme) => { - return StyleSheet.create({ - statusWrapper: { - position: 'absolute', - bottom: 0, - right: 0, - overflow: 'hidden', - alignItems: 'center', - justifyContent: 'center', - borderColor: theme.centerChannelBg - }, - statusContainer: { - alignItems: 'center', - justifyContent: 'center', - overflow: 'hidden' - }, - status: { - color: theme.centerChannelBg - }, - online: { - backgroundColor: theme.onlineIndicator - }, - away: { - backgroundColor: theme.awayIndicator - }, - offline: { - backgroundColor: theme.centerChannelBg, - borderColor: '#bababa' - } - }); -}); - const statusToIcon = { online: 'check', away: 'minus' @@ -134,3 +102,35 @@ export default class ProfilePicture extends React.PureComponent { ); } } + +const getStyleSheet = makeStyleSheetFromTheme((theme) => { + return StyleSheet.create({ + statusWrapper: { + position: 'absolute', + bottom: 0, + right: 0, + overflow: 'hidden', + alignItems: 'center', + justifyContent: 'center', + borderColor: theme.centerChannelBg + }, + statusContainer: { + alignItems: 'center', + justifyContent: 'center', + overflow: 'hidden' + }, + status: { + color: theme.centerChannelBg + }, + online: { + backgroundColor: theme.onlineIndicator + }, + away: { + backgroundColor: theme.awayIndicator + }, + offline: { + backgroundColor: theme.centerChannelBg, + borderColor: '#bababa' + } + }); +}); diff --git a/app/scenes/load_team/load_team.js b/app/scenes/load_team/load_team.js index 4d97803c4..5570278db 100644 --- a/app/scenes/load_team/load_team.js +++ b/app/scenes/load_team/load_team.js @@ -1,9 +1,7 @@ // Copyright (c) 2017 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import React, {PropTypes, PureComponent} from 'react'; - -import Loading from 'app/components/loading'; +import {PropTypes, PureComponent} from 'react'; import {RequestStatus} from 'service/constants'; @@ -57,6 +55,6 @@ export default class LoadTeam extends PureComponent { } render() { - return ; + return null; } }