From 12896bd23eeba79884245c1c29fdc568cf21a7fa Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 14 Mar 2016 08:50:46 -0400 Subject: Converting to Webpack. Stage 1. --- webapp/components/time_since.jsx | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 webapp/components/time_since.jsx (limited to 'webapp/components/time_since.jsx') diff --git a/webapp/components/time_since.jsx b/webapp/components/time_since.jsx new file mode 100644 index 000000000..02b0174ae --- /dev/null +++ b/webapp/components/time_since.jsx @@ -0,0 +1,67 @@ +// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved. +// See License.txt for license information. + +import Constants from 'utils/constants.jsx'; +import * as Utils from 'utils/utils.jsx'; + +import {FormattedRelative, FormattedDate} from 'react-intl'; + +import {Tooltip, OverlayTrigger} from 'react-bootstrap'; + +import React from 'react'; + +export default class TimeSince extends React.Component { + componentDidMount() { + this.intervalId = setInterval(() => { + this.forceUpdate(); + }, Constants.TIME_SINCE_UPDATE_INTERVAL); + } + componentWillUnmount() { + clearInterval(this.intervalId); + } + render() { + if (this.props.sameUser) { + return ( + + ); + } + + const tooltip = ( + + + + ); + + return ( + + + + ); + } +} + +TimeSince.defaultProps = { + eventTime: 0, + sameUser: false +}; + +TimeSince.propTypes = { + eventTime: React.PropTypes.number.isRequired, + sameUser: React.PropTypes.bool +}; -- cgit v1.2.3-1-g7c22