From f912957aa8e9ef11b017b5b036162198a48aad9d Mon Sep 17 00:00:00 2001 From: Andrei Stanciu Date: Fri, 27 Jan 2017 13:38:59 +0200 Subject: [PATCH] Add permalink to timestamp --- .../post_view/components/post_info.jsx | 1 + .../post_view/components/post_time.jsx | 26 ++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index 3f38bdffe977d..e368e65f4e3ee 100644 --- a/webapp/components/post_view/components/post_info.jsx +++ b/webapp/components/post_view/components/post_info.jsx @@ -376,6 +376,7 @@ export default class PostInfo extends React.Component { sameUser={this.props.sameUser} compactDisplay={this.props.compactDisplay} useMilitaryTime={this.props.useMilitaryTime} + postId={post.id} /> {flagTrigger} diff --git a/webapp/components/post_view/components/post_time.jsx b/webapp/components/post_view/components/post_time.jsx index c8e57f6a94ca9..dab87a7703b6d 100644 --- a/webapp/components/post_view/components/post_time.jsx +++ b/webapp/components/post_view/components/post_time.jsx @@ -6,13 +6,19 @@ import React from 'react'; import Constants from 'utils/constants.jsx'; import PureRenderMixin from 'react-addons-pure-render-mixin'; -import {getDateForUnixTicks} from 'utils/utils.jsx'; +import {getDateForUnixTicks, isMobile} from 'utils/utils.jsx'; + +import {Link} from 'react-router/es6'; +import TeamStore from 'stores/team_store.jsx'; export default class PostTime extends React.Component { constructor(props) { super(props); this.shouldComponentUpdate = PureRenderMixin.shouldComponentUpdate.bind(this); + this.state = { + currentTeamDisplayName: TeamStore.getCurrent().display_name + }; } componentDidMount() { @@ -25,13 +31,26 @@ export default class PostTime extends React.Component { clearInterval(this.intervalId); } - render() { + renderTimeTag() { return ( ); } + + render() { + return isMobile() ? + this.renderTimeTag() : + ( + + {this.renderTimeTag()} + + ); + } } PostTime.defaultProps = { @@ -43,5 +62,6 @@ PostTime.propTypes = { eventTime: React.PropTypes.number.isRequired, sameUser: React.PropTypes.bool, compactDisplay: React.PropTypes.bool, - useMilitaryTime: React.PropTypes.bool.isRequired + useMilitaryTime: React.PropTypes.bool.isRequired, + postId: React.PropTypes.string };