From 719cc0c48585d42575c4a5a7f46c6ad42785525a Mon Sep 17 00:00:00 2001 From: "G.Ambatte" Date: Sat, 14 Sep 2024 22:49:39 +1200 Subject: [PATCH] Remove onClick from UI --- .../homebrew/editor/snippetbar/snippetbar.jsx | 22 +++++++------------ 1 file changed, 8 insertions(+), 14 deletions(-) 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() }