1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import { serviceLimitStore } from '../../../features/serviceLimit';
import Button from '../../ui/Button';
const messages = defineMessages({
headline: {
id: 'service.restrictedHandler.headline',
defaultMessage: '!!!You have reached your service limit.',
},
text: {
id: 'service.restrictedHandler.text',
defaultMessage: '!!!Please upgrade your account to use more than {count} services.',
},
action: {
id: 'service.restrictedHandler.action',
defaultMessage: '!!!Upgrade Account',
},
});
export default @observer class ServiceRestricted extends Component {
static propTypes = {
name: PropTypes.string.isRequired,
upgrade: PropTypes.func.isRequired,
};
static contextTypes = {
intl: intlShape,
};
countdownInterval = null;
countdownIntervalTimeout = 1000;
render() {
const { name, upgrade } = this.props;
const { intl } = this.context;
return (
<div className="services__info-layer">
<h1>{intl.formatMessage(messages.headline)}</h1>
<p>{intl.formatMessage(messages.text, { count: serviceLimitStore.serviceLimit })}</p>
<Button
label={intl.formatMessage(messages.action, { name })}
buttonType="inverted"
onClick={() => upgrade()}
/>
</div>
);
}
}
|