summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2017-10-14 12:17:40 +0200
committerAndrej Mihajlov <and@mullvad.net>2017-10-19 14:16:38 +0200
commit5b5c272d300942964322e88f0455550a8619b4da (patch)
treef4421aa41d2b4e749a4e30019073b506c092e9a4
parentb4d1523b1c477003d19fa0a406bd26211c654325 (diff)
downloadmullvadvpn-5b5c272d300942964322e88f0455550a8619b4da.tar.xz
mullvadvpn-5b5c272d300942964322e88f0455550a8619b4da.zip
Add hook to view support form
-rw-r--r--app/components/Settings.js20
-rw-r--r--app/containers/SettingsPage.js1
-rw-r--r--test/components/Settings.spec.js4
3 files changed, 10 insertions, 15 deletions
diff --git a/app/components/Settings.js b/app/components/Settings.js
index 4410776c01..97db5c9844 100644
--- a/app/components/Settings.js
+++ b/app/components/Settings.js
@@ -14,21 +14,15 @@ export type SettingsProps = {
onQuit: () => void,
onClose: () => void,
onViewAccount: () => void,
- onExternalLink: (type: string) => void,
- onUpdateSettings: (update: $Shape<SettingsReduxState>) => void
+ onViewSupport: () => void,
+ onExternalLink: (type: string) => void
};
export default class Settings extends Component {
props: SettingsProps;
- onClose = () => this.props.onClose();
-
- onExternalLink(type: string) {
- this.props.onExternalLink(type);
- }
-
- render(): React.Element<*> {
+ render() {
const isLoggedIn = this.props.account.status === 'ok';
let isOutOfTime = false, formattedExpiry = '';
let expiryIso = this.props.account.expiry;
@@ -44,7 +38,7 @@ export default class Settings extends Component {
<Header hidden={ true } style={ 'defaultDark' } />
<Container>
<div className="settings">
- <button className="settings__close" onClick={ this.onClose } />
+ <button className="settings__close" onClick={ this.props.onClose } />
<div className="settings__container">
<div className="settings__header">
<h2 className="settings__title">Settings</h2>
@@ -80,15 +74,15 @@ export default class Settings extends Component {
</If>
<div className="settings__external">
- <div className="settings__cell settings__cell--active" onClick={ this.onExternalLink.bind(this, 'faq') }>
+ <div className="settings__cell settings__cell--active" onClick={ this.props.onExternalLink.bind(this, 'faq') }>
<div className="settings__cell-label">FAQs</div>
<img className="settings__cell-icon" src="./assets/images/icon-extLink.svg" />
</div>
- <div className="settings__cell settings__cell--active" onClick={ this.onExternalLink.bind(this, 'guides') }>
+ <div className="settings__cell settings__cell--active" onClick={ this.props.onExternalLink.bind(this, 'guides') }>
<div className="settings__cell-label">Guides</div>
<img className="settings__cell-icon" src="./assets/images/icon-extLink.svg" />
</div>
- <div className="settings__cell settings__cell--active" onClick={ this.onExternalLink.bind(this, 'supportEmail') }>
+ <div className="settings__cell settings__cell--active" onClick={ this.props.onViewSupport }>
<div className="settings__cell-label">Contact support</div>
<img className="settings__cell-disclosure" src="assets/images/icon-chevron.svg" />
</div>
diff --git a/app/containers/SettingsPage.js b/app/containers/SettingsPage.js
index 4f5ef06968..520f27ce6e 100644
--- a/app/containers/SettingsPage.js
+++ b/app/containers/SettingsPage.js
@@ -13,6 +13,7 @@ const mapDispatchToProps = (dispatch, _props) => {
onQuit: () => remote.app.quit(),
onClose: () => dispatch(push('/connect')),
onViewAccount: () => dispatch(push('/settings/account')),
+ onViewSupport: () => dispatch(push('/settings/support')),
onExternalLink: (type) => shell.openExternal(links[type]),
};
};
diff --git a/test/components/Settings.spec.js b/test/components/Settings.spec.js
index 5655e1e5fa..63b1693e6f 100644
--- a/test/components/Settings.spec.js
+++ b/test/components/Settings.spec.js
@@ -43,8 +43,8 @@ describe('components/Settings', () => {
onQuit: () => {},
onClose: () => {},
onViewAccount: () => {},
- onExternalLink: (_type) => {},
- onUpdateSettings: (_update) => {}
+ onViewSupport: () => {},
+ onExternalLink: (_type) => {}
};
return Object.assign({}, defaultProps, mergeProps);
};