diff options
author | 2021-12-18 04:24:10 +0100 | |
---|---|---|
committer | 2021-12-18 04:24:10 +0100 | |
commit | 18494f66a7e0f4020cbc77374d4679421fcf469a (patch) | |
tree | cfd10fb71ca86f4d0580946cee2ccbc8c66dc634 /src/features/nightlyBuilds/Component.js | |
parent | Fix linter (diff) | |
download | ferdium-app-18494f66a7e0f4020cbc77374d4679421fcf469a.tar.gz ferdium-app-18494f66a7e0f4020cbc77374d4679421fcf469a.tar.zst ferdium-app-18494f66a7e0f4020cbc77374d4679421fcf469a.zip |
Refactor autoUpdater usage
Diffstat (limited to 'src/features/nightlyBuilds/Component.js')
-rw-r--r-- | src/features/nightlyBuilds/Component.js | 142 |
1 files changed, 0 insertions, 142 deletions
diff --git a/src/features/nightlyBuilds/Component.js b/src/features/nightlyBuilds/Component.js deleted file mode 100644 index 216e35f65..000000000 --- a/src/features/nightlyBuilds/Component.js +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer, inject } from 'mobx-react'; | ||
4 | import injectSheet from 'react-jss'; | ||
5 | import { defineMessages, injectIntl } from 'react-intl'; | ||
6 | import { H1 } from '../../components/ui/headline'; | ||
7 | |||
8 | import Modal from '../../components/ui/Modal'; | ||
9 | import Button from '../../components/ui/Button'; | ||
10 | import { state as ModalState } from './store'; | ||
11 | import SettingsStore from '../../stores/SettingsStore'; | ||
12 | import UIStore from '../../stores/UIStore'; | ||
13 | import UserStore from '../../stores/UserStore'; | ||
14 | import globalMessages from '../../i18n/globalMessages'; | ||
15 | |||
16 | const messages = defineMessages({ | ||
17 | title: { | ||
18 | id: 'feature.nightlyBuilds.title', | ||
19 | defaultMessage: 'Nightly Builds', | ||
20 | }, | ||
21 | info: { | ||
22 | id: 'feature.nightlyBuilds.info', | ||
23 | defaultMessage: | ||
24 | "Nightly builds are highly experimental versions of Ferdi that may contain unpolished or uncompleted features. These nightly builds are mainly used by developers to test their newly developed features and how they will perform in the final build. If you don't know what you are doing, we suggest not activating nightly builds.", | ||
25 | }, | ||
26 | activate: { | ||
27 | id: 'feature.nightlyBuilds.activate', | ||
28 | defaultMessage: 'Activate', | ||
29 | }, | ||
30 | }); | ||
31 | |||
32 | const styles = theme => ({ | ||
33 | modal: { | ||
34 | width: '80%', | ||
35 | maxWidth: 600, | ||
36 | background: theme.styleTypes.primary.contrast, | ||
37 | paddingTop: 30, | ||
38 | }, | ||
39 | info: { | ||
40 | paddingBottom: 20, | ||
41 | }, | ||
42 | headline: { | ||
43 | fontSize: 20, | ||
44 | marginBottom: 20, | ||
45 | marginTop: -27, | ||
46 | }, | ||
47 | buttonContainer: { | ||
48 | display: 'flex', | ||
49 | }, | ||
50 | button: { | ||
51 | width: '50%', | ||
52 | marginTop: 10, | ||
53 | cursor: 'pointer', | ||
54 | }, | ||
55 | activateButton: { | ||
56 | marginRight: 10, | ||
57 | background: '#c45a5a !important', | ||
58 | color: '#ffffff !important', | ||
59 | }, | ||
60 | }); | ||
61 | |||
62 | class NightlyBuildsModal extends Component { | ||
63 | close() { | ||
64 | ModalState.isModalVisible = false; | ||
65 | |||
66 | const { ui } = this.props.actions; | ||
67 | ui.openSettings({ path: 'app' }); | ||
68 | } | ||
69 | |||
70 | activate() { | ||
71 | const { settings, user } = this.props.actions; | ||
72 | |||
73 | settings.update({ | ||
74 | type: 'app', | ||
75 | data: { | ||
76 | nightly: true, | ||
77 | }, | ||
78 | }); | ||
79 | user.update({ | ||
80 | userData: { | ||
81 | nightly: true, | ||
82 | }, | ||
83 | }); | ||
84 | this.close(); | ||
85 | } | ||
86 | |||
87 | render() { | ||
88 | const { isModalVisible } = ModalState; | ||
89 | |||
90 | const { classes } = this.props; | ||
91 | |||
92 | const { intl } = this.props; | ||
93 | |||
94 | return ( | ||
95 | <Modal | ||
96 | isOpen={isModalVisible} | ||
97 | className={`${classes.modal} nightly-builds`} | ||
98 | shouldCloseOnOverlayClick | ||
99 | close={this.close.bind(this)} | ||
100 | > | ||
101 | <H1 className={classes.headline}> | ||
102 | {intl.formatMessage(messages.title)} | ||
103 | </H1> | ||
104 | |||
105 | <p className={classes.info}>{intl.formatMessage(messages.info)}</p> | ||
106 | |||
107 | <div className={classes.buttonContainer}> | ||
108 | <Button | ||
109 | type="button" | ||
110 | label={intl.formatMessage(messages.activate)} | ||
111 | className={`${classes.button} ${classes.activateButton}`} | ||
112 | onClick={() => this.activate()} | ||
113 | /> | ||
114 | <Button | ||
115 | type="button" | ||
116 | label={intl.formatMessage(globalMessages.cancel)} | ||
117 | className={classes.button} | ||
118 | onClick={() => this.close()} | ||
119 | /> | ||
120 | </div> | ||
121 | </Modal> | ||
122 | ); | ||
123 | } | ||
124 | } | ||
125 | |||
126 | NightlyBuildsModal.propTypes = { | ||
127 | stores: PropTypes.shape({ | ||
128 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
129 | }).isRequired, | ||
130 | actions: PropTypes.shape({ | ||
131 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | ||
132 | user: PropTypes.instanceOf(UserStore).isRequired, | ||
133 | ui: PropTypes.instanceOf(UIStore).isRequired, | ||
134 | }).isRequired, | ||
135 | classes: PropTypes.object.isRequired, | ||
136 | }; | ||
137 | |||
138 | export default injectIntl( | ||
139 | injectSheet(styles)( | ||
140 | inject('stores', 'actions')(observer(NightlyBuildsModal)), | ||
141 | ), | ||
142 | ); | ||