0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-16 12:32:39 +00:00

Remove onClick from UI

This commit is contained in:
G.Ambatte
2024-09-14 22:49:39 +12:00
parent d01548feb6
commit 719cc0c485

View File

@@ -49,8 +49,7 @@ const Snippetbar = createClass({
renderer : this.props.renderer, renderer : this.props.renderer,
themeSelector : false, themeSelector : false,
snippets : [], snippets : [],
historyExists : false, historyExists : false
showHistory : false
}; };
}, },
@@ -149,22 +148,18 @@ const Snippetbar = createClass({
}); });
}, },
showHistory : function () {
if(!this.state.historyExists) return;
this.setState({
showHistory : !this.state.showHistory
});
},
renderHistoryItems : function() { renderHistoryItems : function() {
const historyItems = getHistoryItems(this.props.brew); const historyItems = getHistoryItems(this.props.brew);
return <div className='dropdown'> return <div className='dropdown'>
{_.map(historyItems, (item, index)=>{ {_.map(historyItems, (item, index)=>{
const saveTime = new Date(item.savedAt);
const diffTime = new Date() - saveTime;
const diffMins = Math.floor(diffTime / (60 * 1000));
return <div className='snippet' key={index} > return <div className='snippet' key={index} >
<i className={`fas fa-${index+1}`} /> <i className={`fas fa-${index+1}`} />
<span className='name' title={item.title}>{item.title}</span> <span className='name' title={saveTime.toISOString()}>v{item.version} : about {diffMins} mins ago</span>
</div>; </div>;
})} })}
</div>; </div>;
@@ -190,10 +185,9 @@ const Snippetbar = createClass({
} }
return <div className='editors'> return <div className='editors'>
<div className={`editorTool history ${this.state.historyExists ? 'active' : ''}`} <div className={`editorTool snippetGroup history ${this.state.historyExists ? 'active' : ''}`} >
onClick={this.showHistory} >
<i className='fas fa-clock-rotate-left' /> <i className='fas fa-clock-rotate-left' />
{this.state.showHistory && this.renderHistoryItems() } {this.state.historyExists && this.renderHistoryItems() }
</div> </div>
<div className={`editorTool undo ${this.props.historySize.undo ? 'active' : ''}`} <div className={`editorTool undo ${this.props.historySize.undo ? 'active' : ''}`}
onClick={this.props.undo} > onClick={this.props.undo} >