aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/spellchecker
diff options
context:
space:
mode:
authorLibravatar Stefan Malzner <stefan@adlk.io>2018-11-28 20:51:17 +0100
committerLibravatar Stefan Malzner <stefan@adlk.io>2018-11-28 20:51:17 +0100
commit8b648553a115ed753f78bb81af2752eadaf47754 (patch)
treeb56cfd517a836dffa6b738896df125940f9936b8 /src/features/spellchecker
parentfix(App): App menu was not initialized on app launch. Resolving copy & paste ... (diff)
parentFix linting issues (diff)
downloadferdium-app-8b648553a115ed753f78bb81af2752eadaf47754.tar.gz
ferdium-app-8b648553a115ed753f78bb81af2752eadaf47754.tar.zst
ferdium-app-8b648553a115ed753f78bb81af2752eadaf47754.zip
Merge branch 'update/monetization' into develop
Diffstat (limited to 'src/features/spellchecker')
-rw-r--r--src/features/spellchecker/index.js38
-rw-r--r--src/features/spellchecker/styles.js26
2 files changed, 64 insertions, 0 deletions
diff --git a/src/features/spellchecker/index.js b/src/features/spellchecker/index.js
new file mode 100644
index 000000000..8b3fb7e00
--- /dev/null
+++ b/src/features/spellchecker/index.js
@@ -0,0 +1,38 @@
1import { autorun, reaction } from 'mobx';
2
3const debug = require('debug')('Franz:feature:spellchecker');
4
5const DEFAULT_IS_PREMIUM_FEATURE = true;
6
7export const config = {
8 isPremiumFeature: DEFAULT_IS_PREMIUM_FEATURE,
9};
10
11export default function init(stores) {
12 reaction(
13 () => stores.features.features.isSpellcheckerPremiumFeature,
14 (enabled, r) => {
15 if (enabled) {
16 debug('Initializing `spellchecker` feature');
17
18 // Dispose the reaction to run this only once
19 r.dispose();
20
21 const { isSpellcheckerPremiumFeature } = stores.features.features;
22
23 config.isPremiumFeature = isSpellcheckerPremiumFeature !== undefined ? isSpellcheckerPremiumFeature : DEFAULT_IS_PREMIUM_FEATURE;
24
25 autorun(() => {
26 if (!stores.user.data.isPremium && config.isPremiumFeature) {
27 debug('Override settings.spellcheckerEnabled flag to false');
28
29 Object.assign(stores.settings.all.app, {
30 enableSpellchecker: false,
31 });
32 }
33 });
34 }
35 },
36 );
37}
38
diff --git a/src/features/spellchecker/styles.js b/src/features/spellchecker/styles.js
new file mode 100644
index 000000000..097368d9a
--- /dev/null
+++ b/src/features/spellchecker/styles.js
@@ -0,0 +1,26 @@
1export default (theme) => {
2 console.log(theme);
3 return ({
4 container: {
5 background: theme.colorBackground,
6 position: 'absolute',
7 top: 0,
8 width: '100%',
9 display: 'flex',
10 'flex-direction': 'column',
11 'align-items': 'center',
12 'justify-content': 'center',
13 'z-index': 150,
14 },
15 headline: {
16 color: theme.colorHeadline,
17 margin: [25, 0, 40],
18 'max-width': 500,
19 'text-align': 'center',
20 'line-height': '1.3em',
21 },
22 button: {
23 margin: [40, 0, 20],
24 },
25 });
26};