From bbfb750bafadae49116b1a420664ea753cd9b50b Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Fri, 14 Jun 2019 15:29:04 +0200 Subject: Restrict services with customURL when not premium user --- .../services/content/ServiceRestricted.js | 38 ++++++++++++++++++---- src/components/services/content/ServiceView.js | 2 +- 2 files changed, 32 insertions(+), 8 deletions(-) (limited to 'src/components/services') 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'; import { serviceLimitStore } from '../../../features/serviceLimit'; import Button from '../../ui/Button'; +import { RESTRICTION_TYPES } from '../../../models/Service'; const messages = defineMessages({ - headline: { - id: 'service.restrictedHandler.headline', + headlineServiceLimit: { + id: 'service.restrictedHandler.serviceLimit.headline', defaultMessage: '!!!You have reached your service limit.', }, - text: { - id: 'service.restrictedHandler.text', + textServiceLimit: { + id: 'service.restrictedHandler.serviceLimit.text', defaultMessage: '!!!Please upgrade your account to use more than {count} services.', }, + headlineCustomUrl: { + id: 'service.restrictedHandler.customUrl.headline', + defaultMessage: '!!!Franz Professional Plan required', + }, + textCustomUrl: { + id: 'service.restrictedHandler.customUrl.text', + defaultMessage: '!!!Please upgrade to the Franz Professional plan to use custom urls & self hosted services.', + }, action: { id: 'service.restrictedHandler.action', defaultMessage: '!!!Upgrade Account', @@ -25,6 +34,7 @@ export default @observer class ServiceRestricted extends Component { static propTypes = { name: PropTypes.string.isRequired, upgrade: PropTypes.func.isRequired, + type: PropTypes.number.isRequired, }; static contextTypes = { @@ -36,13 +46,27 @@ export default @observer class ServiceRestricted extends Component { countdownIntervalTimeout = 1000; render() { - const { name, upgrade } = this.props; + const { + name, + upgrade, + type, + } = this.props; const { intl } = this.context; return (
-

{intl.formatMessage(messages.headline)}

-

{intl.formatMessage(messages.text, { count: serviceLimitStore.serviceLimit })}

+ {type === RESTRICTION_TYPES.SERVICE_LIMIT && ( + <> +

{intl.formatMessage(messages.headlineServiceLimit)}

+

{intl.formatMessage(messages.textServiceLimit, { count: serviceLimitStore.serviceLimit })}

+ + )} + {type === RESTRICTION_TYPES.CUSTOM_URL && ( + <> +

{intl.formatMessage(messages.headlineCustomUrl)}

+

{intl.formatMessage(messages.textCustomUrl)}

+ + )}