PLT-5726 Fix post profile picture tap (#345)

* PLT-5726 Fix post user image tap

* Fix double loading showing up

* conditional reply bar
This commit is contained in:
enahum 2017-03-13 13:51:20 -03:00 committed by Harrison Healey
parent 31d89c37fe
commit 8bc6a0cb14
3 changed files with 56 additions and 64 deletions

View file

@ -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 <View style={replyBarStyle}/>;
}
};
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 (
<TouchableHighlight onPress={this.handlePress}>
<View style={{flex: 1}}>
{replyBar && this.renderReplyBar(style)}
{this.props.post.message.length > 0 &&
<Text style={messageStyle}>
{this.props.post.message}
</Text>
}
{this.renderFileAttachments()}
</View>
</TouchableHighlight>
);
};
render() {
const style = getStyleSheet(this.props.theme);
@ -211,15 +227,7 @@ export default class Post extends Component {
<View>
{this.renderCommentedOnMessage(style)}
</View>
<View style={style.messageContainerWithReplyBar}>
{this.renderReplyBar(style)}
{this.props.post.message.length > 0 &&
<Text style={messageStyle}>
{this.props.post.message}
</Text>
}
{this.renderFileAttachments()}
</View>
{this.renderMessage(style, messageStyle, true)}
</View>
</View>
);
@ -238,30 +246,16 @@ export default class Post extends Component {
<FormattedTime value={this.props.post.create_at}/>
</Text>
</View>
<View style={style.messageContainer}>
{this.props.post.message.length > 0 &&
<Text style={messageStyle}>
{this.props.post.message}
</Text>
}
{this.renderFileAttachments()}
</View>
{this.renderMessage(style, messageStyle)}
</View>
</View>
</View>
);
}
if (this.props.onPress) {
return (
<TouchableHighlight onPress={this.handlePress}>
{contents}
</TouchableHighlight>
);
}
return contents;
}
}
const getStyleSheet = makeStyleSheetFromTheme((theme) => {

View file

@ -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'
}
});
});

View file

@ -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 <Loading/>;
return null;
}
}