diff options
author | Stefan Malzner <stefan@adlk.io> | 2019-06-13 15:15:38 +0200 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2019-06-13 15:15:38 +0200 |
commit | 66647005ae23bccf1691a43ea36565cae4ce9518 (patch) | |
tree | 08d5c2a8bf3326e5b36c64bdcf7edd6ebda1ff2f /src | |
parent | Merge branch 'develop' into feature/service-limit (diff) | |
download | ferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.tar.gz ferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.tar.zst ferdium-app-66647005ae23bccf1691a43ea36565cae4ce9518.zip |
Improve serviceLimit implementation
Diffstat (limited to 'src')
-rw-r--r-- | src/components/settings/navigation/SettingsNavigation.js | 8 | ||||
-rw-r--r-- | src/features/serviceLimit/components/LimitReachedInfobox.js | 4 | ||||
-rw-r--r-- | src/features/serviceLimit/index.js | 2 | ||||
-rw-r--r-- | src/features/serviceLimit/store.js | 6 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 2 |
5 files changed, 16 insertions, 6 deletions
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js index df4b3b3b2..4696b82eb 100644 --- a/src/components/settings/navigation/SettingsNavigation.js +++ b/src/components/settings/navigation/SettingsNavigation.js | |||
@@ -8,6 +8,7 @@ import Link from '../../ui/Link'; | |||
8 | import { workspaceStore } from '../../../features/workspaces'; | 8 | import { workspaceStore } from '../../../features/workspaces'; |
9 | import UIStore from '../../../stores/UIStore'; | 9 | import UIStore from '../../../stores/UIStore'; |
10 | import UserStore from '../../../stores/UserStore'; | 10 | import UserStore from '../../../stores/UserStore'; |
11 | import { serviceLimitStore } from '../../../features/serviceLimit'; | ||
11 | 12 | ||
12 | const messages = defineMessages({ | 13 | const messages = defineMessages({ |
13 | availableServices: { | 14 | availableServices: { |
@@ -80,7 +81,12 @@ export default @inject('stores') @observer class SettingsNavigation extends Comp | |||
80 | > | 81 | > |
81 | {intl.formatMessage(messages.yourServices)} | 82 | {intl.formatMessage(messages.yourServices)} |
82 | {' '} | 83 | {' '} |
83 | <span className="badge">{serviceCount}</span> | 84 | <span className="badge"> |
85 | {serviceCount} | ||
86 | {serviceLimitStore.serviceLimit !== 0 && ( | ||
87 | `/${serviceLimitStore.serviceLimit}` | ||
88 | )} | ||
89 | </span> | ||
84 | </Link> | 90 | </Link> |
85 | {workspaceStore.isFeatureEnabled ? ( | 91 | {workspaceStore.isFeatureEnabled ? ( |
86 | <Link | 92 | <Link |
diff --git a/src/features/serviceLimit/components/LimitReachedInfobox.js b/src/features/serviceLimit/components/LimitReachedInfobox.js index ee0d7cb27..fc54dcf85 100644 --- a/src/features/serviceLimit/components/LimitReachedInfobox.js +++ b/src/features/serviceLimit/components/LimitReachedInfobox.js | |||
@@ -26,6 +26,10 @@ const styles = theme => ({ | |||
26 | borderRadius: 0, | 26 | borderRadius: 0, |
27 | marginBottom: 0, | 27 | marginBottom: 0, |
28 | 28 | ||
29 | '& > div': { | ||
30 | marginBottom: 0, | ||
31 | }, | ||
32 | |||
29 | '& button': { | 33 | '& button': { |
30 | color: theme.styleTypes.primary.contrast, | 34 | color: theme.styleTypes.primary.contrast, |
31 | }, | 35 | }, |
diff --git a/src/features/serviceLimit/index.js b/src/features/serviceLimit/index.js index 76f996195..92ad8bb98 100644 --- a/src/features/serviceLimit/index.js +++ b/src/features/serviceLimit/index.js | |||
@@ -15,7 +15,7 @@ export default function initServiceLimit(stores, actions) { | |||
15 | // Toggle serviceLimit feature | 15 | // Toggle serviceLimit feature |
16 | reaction( | 16 | reaction( |
17 | () => ( | 17 | () => ( |
18 | features.features.hasServiceLimit | 18 | features.features.isServiceLimitEnabled |
19 | ), | 19 | ), |
20 | (isEnabled) => { | 20 | (isEnabled) => { |
21 | if (isEnabled) { | 21 | if (isEnabled) { |
diff --git a/src/features/serviceLimit/store.js b/src/features/serviceLimit/store.js index 752f71371..9836c5f51 100644 --- a/src/features/serviceLimit/store.js +++ b/src/features/serviceLimit/store.js | |||
@@ -24,12 +24,12 @@ export class ServiceLimitStore extends FeatureStore { | |||
24 | @computed get userHasReachedServiceLimit() { | 24 | @computed get userHasReachedServiceLimit() { |
25 | if (!this.isServiceLimitEnabled) return false; | 25 | if (!this.isServiceLimitEnabled) return false; |
26 | 26 | ||
27 | const { user } = this.stores; | 27 | return this.serviceLimit !== 0 && this.serviceCount >= this.serviceLimit; |
28 | |||
29 | return !user.isPremium && this.serviceCount >= this.serviceLimit; | ||
30 | } | 28 | } |
31 | 29 | ||
32 | @computed get serviceLimit() { | 30 | @computed get serviceLimit() { |
31 | if (!this.isServiceLimitEnabled || this.stores.features.features.serviceLimitCount === 0) return 0; | ||
32 | |||
33 | return this.stores.features.features.serviceLimitCount || DEFAULT_SERVICE_LIMIT; | 33 | return this.stores.features.features.serviceLimitCount || DEFAULT_SERVICE_LIMIT; |
34 | } | 34 | } |
35 | 35 | ||
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index a821dbe39..eded7b79b 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -5,7 +5,7 @@ | |||
5 | "feature.delayApp.action": "Get a Franz Supporter License", | 5 | "feature.delayApp.action": "Get a Franz Supporter License", |
6 | "feature.delayApp.headline": "Please purchase a Franz Supporter License to skip waiting", | 6 | "feature.delayApp.headline": "Please purchase a Franz Supporter License to skip waiting", |
7 | "feature.delayApp.text": "Franz will continue in {seconds} seconds.", | 7 | "feature.delayApp.text": "Franz will continue in {seconds} seconds.", |
8 | "feature.serviceLimit.limitReached": "You have added {amount} of {limit} services. Please upgrade your account to add more services.", | 8 | "feature.serviceLimit.limitReached": "You have added {amount} out of {limit} services that are included in your plan. Please upgrade your account to add more services.", |
9 | "feature.shareFranz.action.email": "Send as email", | 9 | "feature.shareFranz.action.email": "Send as email", |
10 | "feature.shareFranz.action.facebook": "Share on Facebook", | 10 | "feature.shareFranz.action.facebook": "Share on Facebook", |
11 | "feature.shareFranz.action.twitter": "Share on Twitter", | 11 | "feature.shareFranz.action.twitter": "Share on Twitter", |