diff options
Diffstat (limited to 'src/components/settings')
-rw-r--r-- | src/components/settings/account/AccountDashboard.tsx (renamed from src/components/settings/account/AccountDashboard.js) | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/components/settings/account/AccountDashboard.js b/src/components/settings/account/AccountDashboard.tsx index a1612cf8b..8d6cfdfe6 100644 --- a/src/components/settings/account/AccountDashboard.js +++ b/src/components/settings/account/AccountDashboard.tsx | |||
@@ -1,14 +1,14 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component } from 'react'; |
2 | import PropTypes from 'prop-types'; | 2 | import { observer } from 'mobx-react'; |
3 | import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; | 3 | import {defineMessages, injectIntl, WrappedComponentProps} from 'react-intl'; |
4 | import { defineMessages, injectIntl } from 'react-intl'; | ||
5 | import ReactTooltip from 'react-tooltip'; | 4 | import ReactTooltip from 'react-tooltip'; |
6 | import { H1, H2 } from '../../ui/headline'; | 5 | import { H1, H2 } from '../../ui/headline'; |
7 | 6 | ||
8 | import Loader from '../../ui/Loader'; | 7 | import Loader from '../../ui/Loader'; |
9 | import Button from '../../ui/button'; | 8 | import Button from '../../ui/button'; |
10 | import Infobox from '../../ui/Infobox'; | 9 | import Infobox from '../../ui/infobox'; |
11 | import { LOCAL_SERVER, LIVE_FRANZ_API } from '../../../config'; | 10 | import { LOCAL_SERVER, LIVE_FRANZ_API } from '../../../config'; |
11 | import User from "../../../models/User"; | ||
12 | 12 | ||
13 | const messages = defineMessages({ | 13 | const messages = defineMessages({ |
14 | headline: { | 14 | headline: { |
@@ -64,19 +64,21 @@ const messages = defineMessages({ | |||
64 | }, | 64 | }, |
65 | }); | 65 | }); |
66 | 66 | ||
67 | class AccountDashboard extends Component { | 67 | interface IProp extends WrappedComponentProps { |
68 | static propTypes = { | 68 | user: User; |
69 | user: MobxPropTypes.observableObject.isRequired, | 69 | isLoading: boolean; |
70 | isLoading: PropTypes.bool.isRequired, | 70 | userInfoRequestFailed: boolean; |
71 | userInfoRequestFailed: PropTypes.bool.isRequired, | 71 | isLoadingDeleteAccount: boolean; |
72 | retryUserInfoRequest: PropTypes.func.isRequired, | 72 | isDeleteAccountSuccessful: boolean; |
73 | deleteAccount: PropTypes.func.isRequired, | 73 | server: string; |
74 | isLoadingDeleteAccount: PropTypes.bool.isRequired, | 74 | retryUserInfoRequest: () => void; |
75 | isDeleteAccountSuccessful: PropTypes.bool.isRequired, | 75 | deleteAccount: () => void; |
76 | openEditAccount: PropTypes.func.isRequired, | 76 | openEditAccount: () => void; |
77 | openInvoices: PropTypes.func.isRequired, | 77 | openInvoices: () => void; |
78 | server: PropTypes.string.isRequired, | 78 | } |
79 | }; | 79 | |
80 | @observer | ||
81 | class AccountDashboard extends Component<IProp> { | ||
80 | 82 | ||
81 | render() { | 83 | render() { |
82 | const { | 84 | const { |
@@ -131,7 +133,6 @@ class AccountDashboard extends Component { | |||
131 | ctaLabel={intl.formatMessage( | 133 | ctaLabel={intl.formatMessage( |
132 | messages.tryReloadUserInfoRequest, | 134 | messages.tryReloadUserInfoRequest, |
133 | )} | 135 | )} |
134 | ctaLoading={isLoading} | ||
135 | ctaOnClick={retryUserInfoRequest} | 136 | ctaOnClick={retryUserInfoRequest} |
136 | > | 137 | > |
137 | {intl.formatMessage(messages.userInfoRequestFailed)} | 138 | {intl.formatMessage(messages.userInfoRequestFailed)} |
@@ -221,4 +222,4 @@ class AccountDashboard extends Component { | |||
221 | } | 222 | } |
222 | } | 223 | } |
223 | 224 | ||
224 | export default injectIntl(observer(AccountDashboard)); | 225 | export default injectIntl(AccountDashboard); |