import React, { Component } from 'react' import PropTypes from 'prop-types' import { connect } from 'react-redux' import FileChooser from '../common/FileChooser' import Dropdown, {Divider} from '../common/Dropdown' import * as flowsActions from '../../ducks/flows' import * as modalActions from '../../ducks/ui/modal' FileMenu.propTypes = { clearFlows: PropTypes.func.isRequired, loadFlows: PropTypes.func.isRequired, saveFlows: PropTypes.func.isRequired, openModal: PropTypes.func.isRequired, } FileMenu.onNewClick = (e, clearFlows) => { e.preventDefault(); if (confirm('Delete all flows?')) clearFlows() } export function FileMenu ({clearFlows, loadFlows, saveFlows, openModal}) { return ( FileMenu.onNewClick(e, clearFlows)}>  New loadFlows(file)} /> { e.preventDefault(); saveFlows();}}>  Save... { e.preventDefault(); openModal(); }}>  Options  Install Certificates... ) } export default connect( null, { clearFlows: flowsActions.clear, loadFlows: flowsActions.upload, saveFlows: flowsActions.download, openModal: () => modalActions.setActiveModal('OptionModal'), } )(FileMenu)