blob: ab288bd0e31dfd776442b48db4f971ee0eb5fa91 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { push } from 'react-router-redux';
import { shell } from 'electron';
import { links } from '../config';
import Connect from '../components/Connect';
import connectActions from '../redux/connection/actions';
const mapStateToProps = (state) => {
return state;
};
const mapDispatchToProps = (dispatch, props) => {
const { connect, disconnect, copyIPAddress } = bindActionCreators(connectActions, dispatch);
const { backend } = props;
return {
onSettings: () => dispatch(push('/settings')),
onSelectLocation: () => dispatch(push('/select-location')),
onConnect: (addr) => connect(backend, addr),
onCopyIP: () => copyIPAddress(),
onDisconnect: () => disconnect(backend),
onExternalLink: (type) => shell.openExternal(links[type]),
getServerInfo: (key) => backend.serverInfo(key)
};
};
export default connect(mapStateToProps, mapDispatchToProps)(Connect);
|