summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-12 16:47:49 -0200
committerJanito Vaqueiro Ferreira Filho <janito@mullvad.net>2018-12-21 14:33:06 -0200
commitca363608f6c125fddfa8d582e40f928b7b17450e (patch)
tree8391a83576379bb43c91ec71e00072f96bcc4d0c
parent757274b0272c184358770cee6185541d9f32675b (diff)
downloadmullvadvpn-ca363608f6c125fddfa8d582e40f928b7b17450e.tar.xz
mullvadvpn-ca363608f6c125fddfa8d582e40f928b7b17450e.zip
Disable buy more credit button when offline
-rw-r--r--gui/packages/desktop/src/renderer/components/Account.js2
-rw-r--r--gui/packages/desktop/src/renderer/containers/AccountPage.js1
-rw-r--r--gui/packages/desktop/test/components/Account.spec.js1
3 files changed, 4 insertions, 0 deletions
diff --git a/gui/packages/desktop/src/renderer/components/Account.js b/gui/packages/desktop/src/renderer/components/Account.js
index 8db9887993..6d5c537f92 100644
--- a/gui/packages/desktop/src/renderer/components/Account.js
+++ b/gui/packages/desktop/src/renderer/components/Account.js
@@ -15,6 +15,7 @@ type Props = {
accountToken: AccountToken,
accountExpiry: ?string,
expiryLocale: string,
+ isOffline: boolean,
onLogout: () => void,
onClose: () => void,
onBuyMore: () => void,
@@ -58,6 +59,7 @@ export default class Account extends Component<Props> {
<View style={styles.account__footer}>
<AppButton.GreenButton
style={styles.account__buy_button}
+ disabled={this.props.isOffline}
onPress={this.props.onBuyMore}
text="Buy more credit"
icon="icon-extLink"
diff --git a/gui/packages/desktop/src/renderer/containers/AccountPage.js b/gui/packages/desktop/src/renderer/containers/AccountPage.js
index fc9d5394be..94cb653d81 100644
--- a/gui/packages/desktop/src/renderer/containers/AccountPage.js
+++ b/gui/packages/desktop/src/renderer/containers/AccountPage.js
@@ -14,6 +14,7 @@ const mapStateToProps = (state: ReduxState) => ({
accountToken: state.account.accountToken,
accountExpiry: state.account.expiry,
expiryLocale: remote.app.getLocale(),
+ isOffline: state.connection.isBlocked,
});
const mapDispatchToProps = (dispatch: ReduxDispatch, props: SharedRouteProps) => {
const history = bindActionCreators({ goBack }, dispatch);
diff --git a/gui/packages/desktop/test/components/Account.spec.js b/gui/packages/desktop/test/components/Account.spec.js
index 4813f3d20e..4868b6bab6 100644
--- a/gui/packages/desktop/test/components/Account.spec.js
+++ b/gui/packages/desktop/test/components/Account.spec.js
@@ -13,6 +13,7 @@ describe('components/Account', () => {
accountToken: '1234',
accountExpiry: new Date('2038-01-01').toISOString(),
expiryLocale: 'en-US',
+ isOffline: false,
updateAccountExpiry: () => Promise.resolve(),
onClose: () => {},
onLogout: () => {},