diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-14 23:32:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 03:02:05 +0530 |
commit | 137555821f172e4eadc7cf099d4270ae8fc1374e (patch) | |
tree | 693882bbf7a6b2a24b5a727091d09586d0371007 /src/features/nightlyBuilds/index.ts | |
parent | New translations en-US.json (Spanish) (#2072) (diff) | |
download | ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.gz ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.tar.zst ferdium-app-137555821f172e4eadc7cf099d4270ae8fc1374e.zip |
chore: convert components to tsx (#2071)
Diffstat (limited to 'src/features/nightlyBuilds/index.ts')
-rw-r--r-- | src/features/nightlyBuilds/index.ts | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/features/nightlyBuilds/index.ts b/src/features/nightlyBuilds/index.ts new file mode 100644 index 000000000..14afbaf1b --- /dev/null +++ b/src/features/nightlyBuilds/index.ts | |||
@@ -0,0 +1,41 @@ | |||
1 | import { state as ModalState } from './store'; | ||
2 | |||
3 | export { default as Component } from './Component'; | ||
4 | |||
5 | const debug = require('debug')('Ferdi:feature:nightlyBuilds'); | ||
6 | |||
7 | const state = ModalState; | ||
8 | |||
9 | export default function initialize() { | ||
10 | debug('Initialize nightlyBuilds feature'); | ||
11 | |||
12 | function showModal() { | ||
13 | state.isModalVisible = true; | ||
14 | } | ||
15 | |||
16 | function toggleFeature() { | ||
17 | if (window['ferdi'].stores.settings.app.nightly) { | ||
18 | window['ferdi'].actions.settings.update({ | ||
19 | type: 'app', | ||
20 | data: { | ||
21 | nightly: false, | ||
22 | }, | ||
23 | }); | ||
24 | window['ferdi'].actions.user.update({ | ||
25 | userData: { | ||
26 | nightly: false, | ||
27 | }, | ||
28 | }); | ||
29 | } else { | ||
30 | // We need to close the settings, otherwise the modal will be drawn under the settings window | ||
31 | window['ferdi'].actions.ui.closeSettings(); | ||
32 | showModal(); | ||
33 | } | ||
34 | } | ||
35 | |||
36 | window['ferdi'].features.nightlyBuilds = { | ||
37 | state, | ||
38 | showModal, | ||
39 | toggleFeature, | ||
40 | }; | ||
41 | } | ||