import React, { Component, PropTypes } from 'react' import { connect } from 'react-redux' import classnames from 'classnames' import FileChooser from '../common/FileChooser' import Dropdown from '../common/Dropdown' import * as flowsActions from '../../ducks/flows' class FileMenu extends Component { static propTypes = { clearFlows: PropTypes.func.isRequired, loadFlows: PropTypes.func.isRequired, saveFlows: PropTypes.func.isRequired } constructor(props, context) { super(props, context) this.onNewClick = this.onNewClick.bind(this) this.onOpenClick = this.onOpenClick.bind(this) this.onOpenFile = this.onOpenFile.bind(this) this.onSaveClick = this.onSaveClick.bind(this) } onNewClick(e) { e.preventDefault() if (confirm('Delete all flows?')) { this.props.clearFlows() } } onOpenFile(file) { this.props.loadFlows(file) } onSaveClick(e) { e.preventDefault() this.props.saveFlows() } render() { return ( New Save... Install Certificates... ) } } export default connect( null, { clearFlows: flowsActions.clear, loadFlows: flowsActions.upload, saveFlows: flowsActions.download, } )(FileMenu)