import React, {Component, PropTypes} from 'react'; import {connect} from 'react-redux' import {bindActionCreators} from 'redux'; import {Tab, Tabs, TabList, TabPanel} from 'react-tabs' import {shell} from 'electron'; import Input from './base/Input'; import Link from './base/Link'; import Modal from './base/Modal'; import ModalBody from './base/ModalBody'; import ModalHeader from './base/ModalHeader'; import ModalFooter from './base/ModalFooter'; import ModalComponent from './lib/ModalComponent'; import * as GlobalActions from '../redux/modules/global'; import * as db from '../database'; import {MASHAPE_URL} from '../lib/constants'; import {getVersion} from '../lib/appInfo'; class SettingsTabs extends Component { _importFile () { const workspace = this._getActiveWorkspace(this.props); this.props.actions.global.importFile(workspace); } _exportFile () { this.props.actions.global.exportFile(); } _getActiveWorkspace (props) { // TODO: Factor this out into a selector const {entities, workspaces} = props || this.props; let workspace = entities.workspaces[workspaces.activeId]; if (!workspace) { workspace = entities.workspaces[Object.keys(entities.workspaces)[0]]; } return workspace; } render () { const {entities, selectedIndex} = this.props; const settings = entities.settings[Object.keys(entities.settings)[0]]; return ( = 0 ? selectedIndex : 0}> General Import/Export Hotkeys About General Settings db.settingsUpdate(settings, {showPasswords})} /> Show passwords in plain-text db.settingsUpdate(settings, {followRedirects})} /> Follow redirects automatically {/**/} {/* db.settingsUpdate(settings, {useBulkHeaderEditor})}*/} {/*/>*/} {/* */} {/**/} {/*Use bulk header editor by default*/} {/**/} {/**/} {/**/} {/* */} {/**/} {/*Follow Redirects*/} {/**/} {/**/} Request Timeout (ms) (-1 for no timeout) db.settingsUpdate(settings, {timeout})} /> Code Editor Settings db.settingsUpdate(settings, {editorLineWrapping})} /> Wrap Long Lines Font Size (px) db.settingsUpdate(settings, {editorFontSize})} /> Import or export your data, so you can share it or back it up. this._importFile()}> Import {" "} this._exportFile()}> Export Keyboard Insomnia is made with love by me, Gregory Schier. You can help me out by sending your feedback to greg@schier.co or tweet @GetInsomnia. Thanks! ~Gregory ); } } SettingsTabs.propTypes = { workspaces: PropTypes.shape({ activeId: PropTypes.string }), entities: PropTypes.shape({ workspaces: PropTypes.object.isRequired, settings: PropTypes.object.isRequired }).isRequired, actions: PropTypes.shape({ global: PropTypes.shape({ importFile: PropTypes.func.isRequired, exportFile: PropTypes.func.isRequired, }) }), // Optional selectedIndex: PropTypes.number }; function mapStateToProps (state) { return { workspaces: state.workspaces, entities: state.entities, actions: state.actions, loading: state.global.loading }; } function mapDispatchToProps (dispatch) { return { actions: { global: bindActionCreators(GlobalActions, dispatch) } } } // NOTE: We can't _connect_ the SettingsModal because it hides the public methods const ConnectedSettingsTabs = connect( mapStateToProps, mapDispatchToProps )(SettingsTabs); class SettingsModal extends ModalComponent { constructor (props) { super(props); this.state = { selectedIndex: 0 } } show (selectedIndex = 0) { super.show(); if (selectedIndex >= 0) { this.setState({selectedIndex}); } else { this.setState({selectedIndex: 0}); } } render () { const {selectedIndex} = this.state; return ( Insomnia {" "} v{getVersion()} Supported By ); } } export default SettingsModal;
Import or export your data, so you can share it or back it up.
this._importFile()}> Import {" "} this._exportFile()}> Export
Insomnia is made with love by me, Gregory Schier.
You can help me out by sending your feedback to greg@schier.co or tweet @GetInsomnia.
Thanks!
~Gregory