diff --git a/client/homebrew/editor/snippetbar/snippetbar.jsx b/client/homebrew/editor/snippetbar/snippetbar.jsx index cfe28991c..f282cd8b6 100644 --- a/client/homebrew/editor/snippetbar/snippetbar.jsx +++ b/client/homebrew/editor/snippetbar/snippetbar.jsx @@ -49,8 +49,7 @@ const Snippetbar = createClass({ renderer : this.props.renderer, themeSelector : false, snippets : [], - historyExists : false, - showHistory : false + historyExists : false }; }, @@ -149,22 +148,18 @@ const Snippetbar = createClass({ }); }, - showHistory : function () { - if(!this.state.historyExists) return; - - this.setState({ - showHistory : !this.state.showHistory - }); - }, - renderHistoryItems : function() { const historyItems = getHistoryItems(this.props.brew); return
{_.map(historyItems, (item, index)=>{ + const saveTime = new Date(item.savedAt); + const diffTime = new Date() - saveTime; + const diffMins = Math.floor(diffTime / (60 * 1000)); + return
- {item.title} + v{item.version} : about {diffMins} mins ago
; })}
; @@ -190,10 +185,9 @@ const Snippetbar = createClass({ } return
-
+
- {this.state.showHistory && this.renderHistoryItems() } + {this.state.historyExists && this.renderHistoryItems() }