diff --git a/webapp/app.jsx b/webapp/app.jsx
index c2f4a65..624a190 100644
--- a/webapp/app.jsx
+++ b/webapp/app.jsx
@@ -11,7 +11,6 @@ require('normalize.css')
require('skeleton.css')
require('style.css')
require('raleway.css')
-require('font-awesome.min.css')
// Load Components
diff --git a/webapp/components/clock.jsx b/webapp/components/clock.jsx
new file mode 100644
index 0000000..10136d9
--- /dev/null
+++ b/webapp/components/clock.jsx
@@ -0,0 +1,25 @@
+var React = require('react')
+var Icon = require('icon.jsx')
+
+module.exports = React.createClass({
+ getInitialState: function(){
+ return { moment: false }
+ },
+ componentDidMount: function(){
+ require.ensure(['moment'],_ => {
+ if(this.isMounted()) this.setState({ moment: require('moment') })
+ })
+ },
+ getDate: function(){
+ if(this.props.date){
+ if(this.state.moment)
+ return this.state.moment.unix(this.props.date).fromNow()
+ else return
+ } else {
+ return 'Unknown Date'
+ }
+ },
+ render: function(){
+ return
{this.getDate()}
+ }
+})
diff --git a/webapp/components/comment.jsx b/webapp/components/comment.jsx
index bc6767a..5134dcd 100644
--- a/webapp/components/comment.jsx
+++ b/webapp/components/comment.jsx
@@ -1,6 +1,7 @@
var React = require('react')
var Markdown = require('markdown.jsx')
var Icon = require('icon.jsx')
+var Clock = require('clock.jsx')
module.exports = function(boardsAPI){
var UserID = require('userID.jsx')(boardsAPI)
@@ -13,21 +14,12 @@ module.exports = function(boardsAPI){
if(this.isMounted()) this.setState({ moment: require('moment') })
})
},
- getDate: function(){
- if(this.props.comment.date){
- if(this.state.moment)
- return this.state.moment.unix(this.props.comment.date).fromNow()
- else return '...'
- } else {
- return 'Unknown Date'
- }
- },
render: function(){
if(this.props.comment){
return
diff --git a/webapp/components/icon.jsx b/webapp/components/icon.jsx
index c697bd8..24a7754 100644
--- a/webapp/components/icon.jsx
+++ b/webapp/components/icon.jsx
@@ -1,4 +1,5 @@
var React = require('react')
+require('font-awesome.min.css')
module.exports = React.createClass({
class: function(){
diff --git a/webapp/components/post.jsx b/webapp/components/post.jsx
index 4d147d3..c34deac 100644
--- a/webapp/components/post.jsx
+++ b/webapp/components/post.jsx
@@ -2,19 +2,11 @@ var React = require('react')
var Markdown = require('markdown.jsx')
var Icon = require('icon.jsx')
var Link = require('react-router').Link
+var Clock = require('clock.jsx')
module.exports = function(boardsAPI){
var UserID = require('userID.jsx')(boardsAPI)
return React.createClass({
- getDate: function(){
- if(this.props.post.date){
- if(this.state.moment)
- return this.state.moment.unix(this.props.post.date).fromNow()
- else return '...'
- } else {
- return 'Unknown Date'
- }
- },
getInitialState: function(){
return { moment: false }
},
@@ -41,7 +33,7 @@ module.exports = function(boardsAPI){
- {this.getDate()}
+
View
diff --git a/webapp/style.css b/webapp/style.css
index 653c24d..271f481 100644
--- a/webapp/style.css
+++ b/webapp/style.css
@@ -20,6 +20,10 @@ a {
text-decoration: none;
}
+.clock {
+ display: inline
+}
+
.black {
color: black
}