From 1bbed1cb2bf1248e9ca8a1511cfe8a385c5f21f7 Mon Sep 17 00:00:00 2001 From: Andrei Stanciu Date: Fri, 10 Feb 2017 16:56:48 +0200 Subject: Add permalink to timestamp (#5206) * Add permalink to timestamp * Add permalink to timestamp * Add permalink to timestamp * Add permalink to timestamp * fix error with duplicated import * underline permalink on hover --- .../components/post_view/components/post_info.jsx | 1 + .../components/post_view/components/post_time.jsx | 35 ++++++++++++-- webapp/components/rhs_comment.jsx | 53 +++++++++++++++++--- webapp/components/rhs_root_post.jsx | 52 +++++++++++++++++--- webapp/components/search_results_item.jsx | 56 ++++++++++++++++++---- webapp/sass/layout/_post.scss | 13 +++++ webapp/sass/responsive/_tablet.scss | 4 +- webapp/utils/utils.jsx | 4 ++ 8 files changed, 191 insertions(+), 27 deletions(-) diff --git a/webapp/components/post_view/components/post_info.jsx b/webapp/components/post_view/components/post_info.jsx index 3f38bdffe..e368e65f4 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 caad12d4a..25d533e0a 100644 --- a/webapp/components/post_view/components/post_time.jsx +++ b/webapp/components/post_view/components/post_time.jsx @@ -6,26 +6,40 @@ 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, updateWindowDimensions} 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().name, + width: '', + height: '' + }; } componentDidMount() { this.intervalId = setInterval(() => { this.forceUpdate(); }, Constants.TIME_SINCE_UPDATE_INTERVAL); + window.addEventListener('resize', () => { + updateWindowDimensions(this); + }); } componentWillUnmount() { clearInterval(this.intervalId); + window.removeEventListener('resize', () => { + updateWindowDimensions(this); + }); } - render() { + renderTimeTag() { return (