From e31d1834f6b62756e0f0cf81e20e7efcd93ef4af Mon Sep 17 00:00:00 2001 From: enahum Date: Mon, 25 Sep 2017 11:21:06 -0300 Subject: [PATCH] Show full date on search results (#934) --- app/components/post/post.js | 3 +++ app/components/post_header/post_header.js | 31 ++++++++++++++++++++--- app/screens/search/search.js | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/app/components/post/post.js b/app/components/post/post.js index a9d1e04bb..8d38a5f8d 100644 --- a/app/components/post/post.js +++ b/app/components/post/post.js @@ -49,6 +49,7 @@ class Post extends PureComponent { navigator: PropTypes.object, roles: PropTypes.string, shouldRenderReplyButton: PropTypes.bool, + showFullDate: PropTypes.bool, tooltipVisible: PropTypes.bool, theme: PropTypes.object.isRequired, onPress: PropTypes.func, @@ -301,6 +302,7 @@ class Post extends PureComponent { post, renderReplies, shouldRenderReplyButton, + showFullDate, theme } = this.props; const style = getStyleSheet(theme); @@ -324,6 +326,7 @@ class Post extends PureComponent { createAt={post.create_at} isSearchResult={isSearchResult} shouldRenderReplyButton={shouldRenderReplyButton} + showFullDate={showFullDate} onPress={this.handleReply} onViewUserProfile={this.viewUserProfile} renderReplies={renderReplies} diff --git a/app/components/post_header/post_header.js b/app/components/post_header/post_header.js index 0f5b03e85..bdd3738f9 100644 --- a/app/components/post_header/post_header.js +++ b/app/components/post_header/post_header.js @@ -11,6 +11,7 @@ import { import FormattedText from 'app/components/formatted_text'; import FormattedTime from 'app/components/formatted_time'; +import FormattedDate from 'app/components/formatted_date'; import ReplyIcon from 'app/components/reply_icon'; import {emptyFunction} from 'app/utils/general'; import {changeOpacity, makeStyleSheetFromTheme} from 'app/utils/theme'; @@ -33,6 +34,7 @@ export default class PostHeader extends PureComponent { onViewUserProfile: PropTypes.func, overrideUsername: PropTypes.string, renderReplies: PropTypes.bool, + showFullDate: PropTypes.bool, theme: PropTypes.object.isRequired }; @@ -143,20 +145,39 @@ export default class PostHeader extends PureComponent { onPress, renderReplies, shouldRenderReplyButton, + showFullDate, theme } = this.props; const style = getStyleSheet(theme); const showReply = shouldRenderReplyButton || (!commentedOnDisplayName && commentCount > 0 && renderReplies); + let dateComponent; + if (showFullDate) { + dateComponent = ( + + + + + + + + + ); + } else { + dateComponent = ( + + + + ); + } + return ( {this.getDisplayName(style)} - - - + {dateComponent} {showReply && @@ -203,6 +224,10 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => { timeContainer: { justifyContent: 'center' }, + datetime: { + flex: 1, + flexDirection: 'row' + }, time: { color: theme.centerChannelColor, fontSize: 13, diff --git a/app/screens/search/search.js b/app/screens/search/search.js index 686cc9fa6..e6669acb9 100644 --- a/app/screens/search/search.js +++ b/app/screens/search/search.js @@ -301,6 +301,7 @@ class Search extends Component { onReply={this.goToThread} isSearchResult={true} shouldRenderReplyButton={true} + showFullDate={true} navigator={this.props.navigator} /> {separator}