File tree Expand file tree Collapse file tree 2 files changed +25
-14
lines changed
Expand file tree Collapse file tree 2 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,9 @@ import React, { Component } from 'react';
22import { connect } from 'react-redux' ;
33import * as actions from '../../actions/actions' ;
44import HistoryDate from '../display/HistoryDate.jsx' ;
5+ import ClearHistoryBtn from '../display/ClearHistoryBtn.jsx' ;
56import historyController from '../../controllers/historyController' ;
7+
68const { dialog } = require ( 'electron' ) . remote ;
79import parse from 'date-fns/parse'
810
@@ -46,20 +48,7 @@ class HistoryContainer extends Component {
4648 < div className = { 'historyDate-container' } >
4749 < h1 > History</ h1 >
4850 < div className = "clear-history" >
49- < button onClick = { ( ) => {
50- const opts = {
51- type : 'warning' ,
52- buttons : [ 'Okay' , 'Cancel' ] ,
53- message : 'Are you sure you want to clear history?'
54- }
55-
56- dialog . showMessageBox ( null , opts , ( response ) => {
57- if ( response === 0 ) {
58- this . props . clearHistory ( ) ;
59- historyController . clearHistoryFromIndexedDb ( ) ;
60- }
61- } )
62- } } > Clear History</ button >
51+ < ClearHistoryBtn clearHistory = { this . props . clearHistory } />
6352 </ div >
6453 { historyDates }
6554 </ div >
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import historyController from '../../controllers/historyController' ;
3+ const { dialog } = require ( 'electron' ) . remote ;
4+
5+ const ClearHistoryBtn = ( props ) => (
6+ < button onClick = { ( ) => {
7+ const opts = {
8+ type : 'warning' ,
9+ buttons : [ 'Okay' , 'Cancel' ] ,
10+ message : 'Are you sure you want to clear history?'
11+ }
12+
13+ dialog . showMessageBox ( null , opts , ( response ) => {
14+ if ( response === 0 ) {
15+ props . clearHistory ( ) ;
16+ historyController . clearHistoryFromIndexedDb ( ) ;
17+ }
18+ } )
19+ } } > Clear History</ button >
20+ )
21+
22+ export default ClearHistoryBtn ;
You can’t perform that action at this time.
0 commit comments