From 1e7ac66e3bcc796c705ed6a833161cab6bd5b65d Mon Sep 17 00:00:00 2001
From: Christopher Speller <crspeller@gmail.com>
Date: Mon, 2 Nov 2015 08:37:17 -0500
Subject: Some renaming

---
 web/react/components/time_since.jsx | 50 +++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
 create mode 100644 web/react/components/time_since.jsx

(limited to 'web/react/components/time_since.jsx')

diff --git a/web/react/components/time_since.jsx b/web/react/components/time_since.jsx
new file mode 100644
index 000000000..c37739b9c
--- /dev/null
+++ b/web/react/components/time_since.jsx
@@ -0,0 +1,50 @@
+// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+var Utils = require('../utils/utils.jsx');
+
+var Tooltip = ReactBootstrap.Tooltip;
+var OverlayTrigger = ReactBootstrap.OverlayTrigger;
+
+export default class TimeSince extends React.Component {
+    constructor(props) {
+        super(props);
+    }
+    componentDidMount() {
+        this.intervalId = setInterval(() => {
+            this.forceUpdate();
+        }, 30000);
+    }
+    componentWillUnmount() {
+        clearInterval(this.intervalId);
+    }
+    render() {
+        const displayDate = Utils.displayDate(this.props.eventTime);
+        const displayTime = Utils.displayTime(this.props.eventTime);
+
+        const tooltip = (
+            <Tooltip id={'time-since-tooltip-' + this.props.eventTime}>
+                {displayDate + ' at ' + displayTime}
+            </Tooltip>
+        );
+
+        return (
+            <OverlayTrigger
+                delayShow={400}
+                placement='top'
+                overlay={tooltip}
+            >
+                <time className='post-profile-time'>
+                    {Utils.displayDateTime(this.props.eventTime)}
+                </time>
+            </OverlayTrigger>
+        );
+    }
+}
+TimeSince.defaultProps = {
+    eventTime: 0
+};
+
+TimeSince.propTypes = {
+    eventTime: React.PropTypes.number.isRequired
+};
-- 
cgit v1.2.3-1-g7c22

