diff options
Diffstat (limited to 'app/containers')
| -rw-r--r-- | app/containers/AccountPage.js | 7 | ||||
| -rw-r--r-- | app/containers/AdvancedSettingsPage.js | 18 | ||||
| -rw-r--r-- | app/containers/ConnectPage.js | 31 | ||||
| -rw-r--r-- | app/containers/LoginPage.js | 10 | ||||
| -rw-r--r-- | app/containers/PreferencesPage.js | 7 | ||||
| -rw-r--r-- | app/containers/SelectLocationPage.js | 10 | ||||
| -rw-r--r-- | app/containers/SettingsPage.js | 5 | ||||
| -rw-r--r-- | app/containers/SupportPage.js | 7 |
8 files changed, 61 insertions, 34 deletions
diff --git a/app/containers/AccountPage.js b/app/containers/AccountPage.js index d4fdf92b3a..210ad4aaeb 100644 --- a/app/containers/AccountPage.js +++ b/app/containers/AccountPage.js @@ -22,8 +22,11 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onClose: () => { pushHistory('/settings'); }, - onBuyMore: () => openLink(links['purchase']) + onBuyMore: () => openLink(links['purchase']), }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Account); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Account); diff --git a/app/containers/AdvancedSettingsPage.js b/app/containers/AdvancedSettingsPage.js index a1ca7d5a66..0c1312b87f 100644 --- a/app/containers/AdvancedSettingsPage.js +++ b/app/containers/AdvancedSettingsPage.js @@ -11,13 +11,13 @@ import type { SharedRouteProps } from '../routes'; const mapStateToProps = (state: ReduxState) => { const relaySettings = state.settings.relaySettings; - if(relaySettings.normal) { + if (relaySettings.normal) { const { protocol, port } = relaySettings.normal; return { protocol: protocol === 'any' ? 'Automatic' : protocol, port: port === 'any' ? 'Automatic' : port, }; - } else if(relaySettings.custom_tunnel_endpoint) { + } else if (relaySettings.custom_tunnel_endpoint) { const { protocol, port } = relaySettings.custom_tunnel_endpoint; return { protocol, port }; } else { @@ -33,26 +33,30 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onUpdate: async (protocol, port) => { const relayUpdate = RelaySettingsBuilder.normal() .tunnel.openvpn((openvpn) => { - if(protocol === 'Automatic') { + if (protocol === 'Automatic') { openvpn.protocol.any(); } else { openvpn.protocol.exact(protocol.toLowerCase()); } - if(port === 'Automatic') { + if (port === 'Automatic') { openvpn.port.any(); } else { openvpn.port.exact(port); } - }).build(); + }) + .build(); try { await backend.updateRelaySettings(relayUpdate); await backend.fetchRelaySettings(); - } catch(e) { + } catch (e) { log.error('Failed to update relay settings', e.message); } }, }; }; -export default connect(mapStateToProps, mapDispatchToProps)(AdvancedSettings); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(AdvancedSettings); diff --git a/app/containers/ConnectPage.js b/app/containers/ConnectPage.js index 9ce245a927..532dfc8626 100644 --- a/app/containers/ConnectPage.js +++ b/app/containers/ConnectPage.js @@ -13,30 +13,33 @@ import type { SharedRouteProps } from '../routes'; import type { RelaySettingsRedux, RelayLocationRedux } from '../redux/settings/reducers'; -function getRelayName(relaySettings: RelaySettingsRedux, relayLocations: Array<RelayLocationRedux>): string { - if(relaySettings.normal) { +function getRelayName( + relaySettings: RelaySettingsRedux, + relayLocations: Array<RelayLocationRedux>, +): string { + if (relaySettings.normal) { const location = relaySettings.normal.location; - if(location === 'any') { + if (location === 'any') { return 'Automatic'; - } else if(location.country) { + } else if (location.country) { const country = relayLocations.find(({ code }) => code === location.country); - if(country) { + if (country) { return country.name; } - } else if(location.city) { + } else if (location.city) { const [countryCode, cityCode] = location.city; const country = relayLocations.find(({ code }) => code === countryCode); - if(country) { + if (country) { const city = country.cities.find(({ code }) => code === cityCode); - if(city) { + if (city) { return city.name; } } } return 'Unknown'; - } else if(relaySettings.custom_tunnel_endpoint) { + } else if (relaySettings.custom_tunnel_endpoint) { return 'Custom'; } else { throw new Error('Unsupported relay settings.'); @@ -46,10 +49,7 @@ function getRelayName(relaySettings: RelaySettingsRedux, relayLocations: Array<R const mapStateToProps = (state: ReduxState) => { return { accountExpiry: state.account.expiry, - selectedRelayName: getRelayName( - state.settings.relaySettings, - state.settings.relayLocations - ), + selectedRelayName: getRelayName(state.settings.relaySettings, state.settings.relayLocations), connection: state.connection, }; }; @@ -79,4 +79,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Connect); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Connect); diff --git a/app/containers/LoginPage.js b/app/containers/LoginPage.js index 52fac166fa..dbd49dea03 100644 --- a/app/containers/LoginPage.js +++ b/app/containers/LoginPage.js @@ -14,7 +14,10 @@ import type { SharedRouteProps } from '../routes'; const mapStateToProps = (state: ReduxState) => state; const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => { const { push: pushHistory } = bindActionCreators({ push }, dispatch); - const { login, resetLoginError, updateAccountToken } = bindActionCreators(accountActions, dispatch); + const { login, resetLoginError, updateAccountToken } = bindActionCreators( + accountActions, + dispatch, + ); const { backend } = props; return { onSettings: () => { @@ -34,4 +37,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Login); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Login); diff --git a/app/containers/PreferencesPage.js b/app/containers/PreferencesPage.js index 793848d35b..d4eb608038 100644 --- a/app/containers/PreferencesPage.js +++ b/app/containers/PreferencesPage.js @@ -9,7 +9,7 @@ import type { ReduxState, ReduxDispatch } from '../redux/store'; import type { SharedRouteProps } from '../routes'; const mapStateToProps = (state: ReduxState) => ({ - allowLan: state.settings.allowLan + allowLan: state.settings.allowLan, }); const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => { @@ -23,4 +23,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Preferences); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Preferences); diff --git a/app/containers/SelectLocationPage.js b/app/containers/SelectLocationPage.js index b5e12eb4ef..05b4205dfa 100644 --- a/app/containers/SelectLocationPage.js +++ b/app/containers/SelectLocationPage.js @@ -19,8 +19,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => onSelect: async (relayLocation) => { try { const relayUpdate = RelaySettingsBuilder.normal() - .location - .fromRaw(relayLocation) + .location.fromRaw(relayLocation) .build(); await backend.updateRelaySettings(relayUpdate); @@ -31,8 +30,11 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => } catch (e) { log.error('Failed to select server: ', e.message); } - } + }, }; }; -export default connect(mapStateToProps, mapDispatchToProps)(SelectLocation); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(SelectLocation); diff --git a/app/containers/SettingsPage.js b/app/containers/SettingsPage.js index 7c844252d3..24b718485b 100644 --- a/app/containers/SettingsPage.js +++ b/app/containers/SettingsPage.js @@ -30,4 +30,7 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, _props: SharedRouteProps) = }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Settings); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Settings); diff --git a/app/containers/SupportPage.js b/app/containers/SupportPage.js index aaa9f786cd..5d67ddce31 100644 --- a/app/containers/SupportPage.js +++ b/app/containers/SupportPage.js @@ -25,8 +25,11 @@ const mapDispatchToProps = (dispatch: ReduxDispatch, _props: SharedRouteProps) = onSend: (email, message, savedReport) => { return sendProblemReport(email, message, savedReport); - } + }, }; }; -export default connect(mapStateToProps, mapDispatchToProps)(Support); +export default connect( + mapStateToProps, + mapDispatchToProps, +)(Support); |
