aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/services
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2019-06-14 15:29:04 +0200
committerLibravatar Stefan Malzner <stefan@adlk.io>2019-06-14 15:29:04 +0200
commitbbfb750bafadae49116b1a420664ea753cd9b50b (patch)
treedddf11190cfdcfaa8171f7609b1e4d5dd0654dff /src/components/services
parentAdd "service limit reached" screen (diff)
downloadferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.tar.gz
ferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.tar.zst
ferdium-app-bbfb750bafadae49116b1a420664ea753cd9b50b.zip
Restrict services with customURL when not premium user
Diffstat (limited to 'src/components/services')
-rw-r--r--src/components/services/content/ServiceRestricted.js38
-rw-r--r--src/components/services/content/ServiceView.js2
2 files changed, 32 insertions, 8 deletions
diff --git a/src/components/services/content/ServiceRestricted.js b/src/components/services/content/ServiceRestricted.js
index 9fb7d0961..4b8d926aa 100644
--- a/src/components/services/content/ServiceRestricted.js
+++ b/src/components/services/content/ServiceRestricted.js
@@ -5,16 +5,25 @@ import { defineMessages, intlShape } from 'react-intl';
5 5
6import { serviceLimitStore } from '../../../features/serviceLimit'; 6import { serviceLimitStore } from '../../../features/serviceLimit';
7import Button from '../../ui/Button'; 7import Button from '../../ui/Button';
8import { RESTRICTION_TYPES } from '../../../models/Service';
8 9
9const messages = defineMessages({ 10const messages = defineMessages({
10 headline: { 11 headlineServiceLimit: {
11 id: 'service.restrictedHandler.headline', 12 id: 'service.restrictedHandler.serviceLimit.headline',
12 defaultMessage: '!!!You have reached your service limit.', 13 defaultMessage: '!!!You have reached your service limit.',
13 }, 14 },
14 text: { 15 textServiceLimit: {
15 id: 'service.restrictedHandler.text', 16 id: 'service.restrictedHandler.serviceLimit.text',
16 defaultMessage: '!!!Please upgrade your account to use more than {count} services.', 17 defaultMessage: '!!!Please upgrade your account to use more than {count} services.',
17 }, 18 },
19 headlineCustomUrl: {
20 id: 'service.restrictedHandler.customUrl.headline',
21 defaultMessage: '!!!Franz Professional Plan required',
22 },
23 textCustomUrl: {
24 id: 'service.restrictedHandler.customUrl.text',
25 defaultMessage: '!!!Please upgrade to the Franz Professional plan to use custom urls & self hosted services.',
26 },
18 action: { 27 action: {
19 id: 'service.restrictedHandler.action', 28 id: 'service.restrictedHandler.action',
20 defaultMessage: '!!!Upgrade Account', 29 defaultMessage: '!!!Upgrade Account',
@@ -25,6 +34,7 @@ export default @observer class ServiceRestricted extends Component {
25 static propTypes = { 34 static propTypes = {
26 name: PropTypes.string.isRequired, 35 name: PropTypes.string.isRequired,
27 upgrade: PropTypes.func.isRequired, 36 upgrade: PropTypes.func.isRequired,
37 type: PropTypes.number.isRequired,
28 }; 38 };
29 39
30 static contextTypes = { 40 static contextTypes = {
@@ -36,13 +46,27 @@ export default @observer class ServiceRestricted extends Component {
36 countdownIntervalTimeout = 1000; 46 countdownIntervalTimeout = 1000;
37 47
38 render() { 48 render() {
39 const { name, upgrade } = this.props; 49 const {
50 name,
51 upgrade,
52 type,
53 } = this.props;
40 const { intl } = this.context; 54 const { intl } = this.context;
41 55
42 return ( 56 return (
43 <div className="services__info-layer"> 57 <div className="services__info-layer">
44 <h1>{intl.formatMessage(messages.headline)}</h1> 58 {type === RESTRICTION_TYPES.SERVICE_LIMIT && (
45 <p>{intl.formatMessage(messages.text, { count: serviceLimitStore.serviceLimit })}</p> 59 <>
60 <h1>{intl.formatMessage(messages.headlineServiceLimit)}</h1>
61 <p>{intl.formatMessage(messages.textServiceLimit, { count: serviceLimitStore.serviceLimit })}</p>
62 </>
63 )}
64 {type === RESTRICTION_TYPES.CUSTOM_URL && (
65 <>
66 <h1>{intl.formatMessage(messages.headlineCustomUrl)}</h1>
67 <p>{intl.formatMessage(messages.textCustomUrl)}</p>
68 </>
69 )}
46 <Button 70 <Button
47 label={intl.formatMessage(messages.action, { name })} 71 label={intl.formatMessage(messages.action, { name })}
48 buttonType="inverted" 72 buttonType="inverted"
diff --git a/src/components/services/content/ServiceView.js b/src/components/services/content/ServiceView.js
index 18279fd06..f65f51346 100644
--- a/src/components/services/content/ServiceView.js
+++ b/src/components/services/content/ServiceView.js
@@ -133,8 +133,8 @@ export default @observer class ServiceView extends Component {
133 {service.isServiceAccessRestricted ? ( 133 {service.isServiceAccessRestricted ? (
134 <ServiceRestricted 134 <ServiceRestricted
135 name={service.recipe.name} 135 name={service.recipe.name}
136 webview={service.webview}
137 upgrade={upgrade} 136 upgrade={upgrade}
137 type={service.restrictionType}
138 /> 138 />
139 ) : ( 139 ) : (
140 <ServiceWebview 140 <ServiceWebview