aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/ui/SubscriptionPopup.js
diff options
context:
space:
mode:
authorLibravatar haraldox <hnaumann+github@gmail.com>2018-01-19 10:05:51 +0100
committerLibravatar haraldox <hnaumann+github@gmail.com>2018-01-19 10:05:51 +0100
commit7c8782e2a1db34efa8b4ae8160c1041d71448432 (patch)
tree20e6f2158c28d8993f2967c8920ba5c53ac954f7 /src/components/ui/SubscriptionPopup.js
parentfix property change due to mobx-react-form update (diff)
downloadferdium-app-7c8782e2a1db34efa8b4ae8160c1041d71448432.tar.gz
ferdium-app-7c8782e2a1db34efa8b4ae8160c1041d71448432.tar.zst
ferdium-app-7c8782e2a1db34efa8b4ae8160c1041d71448432.zip
change directory structure for subscription
move to own sub-folders `subscription`
Diffstat (limited to 'src/components/ui/SubscriptionPopup.js')
-rw-r--r--src/components/ui/SubscriptionPopup.js83
1 files changed, 0 insertions, 83 deletions
diff --git a/src/components/ui/SubscriptionPopup.js b/src/components/ui/SubscriptionPopup.js
deleted file mode 100644
index 528d02907..000000000
--- a/src/components/ui/SubscriptionPopup.js
+++ /dev/null
@@ -1,83 +0,0 @@
1import React, { Component } from 'react';
2import PropTypes from 'prop-types';
3import { observer } from 'mobx-react';
4import { defineMessages, intlShape } from 'react-intl';
5import Webview from 'react-electron-web-view';
6
7import Button from '../ui/Button';
8
9const messages = defineMessages({
10 buttonCancel: {
11 id: 'subscriptionPopup.buttonCancel',
12 defaultMessage: '!!!Cancel',
13 },
14 buttonDone: {
15 id: 'subscriptionPopup.buttonDone',
16 defaultMessage: '!!!Done',
17 },
18});
19
20@observer
21export default class SubscriptionPopup extends Component {
22 static propTypes = {
23 url: PropTypes.string.isRequired,
24 closeWindow: PropTypes.func.isRequired,
25 completeCheck: PropTypes.func.isRequired,
26 isCompleted: PropTypes.bool.isRequired,
27 };
28
29 static contextTypes = {
30 intl: intlShape,
31 };
32
33 state = {
34 isFakeLoading: false,
35 };
36
37 // We delay the window closing a bit in order to give
38 // the Recurly webhook a few seconds to do it's magic
39 delayedCloseWindow() {
40 this.setState({
41 isFakeLoading: true,
42 });
43
44 setTimeout(() => {
45 this.props.closeWindow();
46 }, 4000);
47 }
48
49 render() {
50 const { url, closeWindow, completeCheck, isCompleted } = this.props;
51 const { intl } = this.context;
52
53 return (
54 <div className="subscription-popup">
55 <div className="subscription-popup__content">
56 <Webview
57 className="subscription-popup__webview"
58
59 autosize
60 src={encodeURI(url)}
61 onDidNavigate={completeCheck}
62 // onNewWindow={(event, url, frameName, options) =>
63 // openWindow({ event, url, frameName, options })}
64 />
65 </div>
66 <div className="subscription-popup__toolbar franz-form">
67 <Button
68 label={intl.formatMessage(messages.buttonCancel)}
69 buttonType="secondary"
70 onClick={closeWindow}
71 disabled={isCompleted}
72 />
73 <Button
74 label={intl.formatMessage(messages.buttonDone)}
75 onClick={() => this.delayedCloseWindow()}
76 disabled={!isCompleted}
77 loaded={!this.state.isFakeLoading}
78 />
79 </div>
80 </div>
81 );
82 }
83}