diff options
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/announcements/api.js | 4 | ||||
-rw-r--r-- | src/features/announcements/index.js | 4 | ||||
-rw-r--r-- | src/features/appearance/index.js | 4 | ||||
-rw-r--r-- | src/features/nightlyBuilds/Component.js | 4 | ||||
-rw-r--r-- | src/features/quickSwitch/Component.js | 8 | ||||
-rwxr-xr-x | src/features/settingsWS/index.js | 4 | ||||
-rw-r--r-- | src/features/shareFranz/Component.js | 159 | ||||
-rw-r--r-- | src/features/shareFranz/index.js | 35 | ||||
-rw-r--r-- | src/features/shareFranz/store.js | 8 | ||||
-rw-r--r-- | src/features/todos/index.js | 8 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawerItem.js | 4 | ||||
-rw-r--r-- | src/features/workspaces/index.js | 8 |
12 files changed, 23 insertions, 227 deletions
diff --git a/src/features/announcements/api.js b/src/features/announcements/api.js index a7fe24bb1..962f3e694 100644 --- a/src/features/announcements/api.js +++ b/src/features/announcements/api.js | |||
@@ -1,14 +1,14 @@ | |||
1 | import { app } from '@electron/remote'; | ||
2 | import Request from '../../stores/lib/Request'; | 1 | import Request from '../../stores/lib/Request'; |
3 | import apiBase from '../../api/apiBase'; | 2 | import apiBase from '../../api/apiBase'; |
4 | import { GITHUB_FERDI_REPO_NAME, GITHUB_NIGHTLIES_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; | 3 | import { GITHUB_FERDI_REPO_NAME, GITHUB_NIGHTLIES_REPO_NAME, GITHUB_ORG_NAME } from '../../config'; |
4 | import { ferdiVersion } from '../../environment'; | ||
5 | 5 | ||
6 | const debug = require('debug')('Ferdi:feature:announcements:api'); | 6 | const debug = require('debug')('Ferdi:feature:announcements:api'); |
7 | 7 | ||
8 | export const announcementsApi = { | 8 | export const announcementsApi = { |
9 | async getCurrentVersion() { | 9 | async getCurrentVersion() { |
10 | debug('getting current version of electron app'); | 10 | debug('getting current version of electron app'); |
11 | return Promise.resolve(app.getVersion()); | 11 | return Promise.resolve(ferdiVersion); |
12 | }, | 12 | }, |
13 | 13 | ||
14 | async getChangelog(version) { | 14 | async getChangelog(version) { |
diff --git a/src/features/announcements/index.js b/src/features/announcements/index.js index 28f0b10ed..19930c5b1 100644 --- a/src/features/announcements/index.js +++ b/src/features/announcements/index.js | |||
@@ -24,8 +24,6 @@ export default function initAnnouncements(stores, actions) { | |||
24 | announcementsStore.stop(); | 24 | announcementsStore.stop(); |
25 | } | 25 | } |
26 | }, | 26 | }, |
27 | { | 27 | { fireImmediately: true }, |
28 | fireImmediately: true, | ||
29 | }, | ||
30 | ); | 28 | ); |
31 | } | 29 | } |
diff --git a/src/features/appearance/index.js b/src/features/appearance/index.js index 87651a3f4..c3425ba9c 100644 --- a/src/features/appearance/index.js +++ b/src/features/appearance/index.js | |||
@@ -235,8 +235,6 @@ export default function initAppearance(stores) { | |||
235 | () => { | 235 | () => { |
236 | updateStyle(settings.all.app); | 236 | updateStyle(settings.all.app); |
237 | }, | 237 | }, |
238 | { | 238 | { fireImmediately: true }, |
239 | fireImmediately: true, | ||
240 | }, | ||
241 | ); | 239 | ); |
242 | } | 240 | } |
diff --git a/src/features/nightlyBuilds/Component.js b/src/features/nightlyBuilds/Component.js index 5a809aaf2..6e5941948 100644 --- a/src/features/nightlyBuilds/Component.js +++ b/src/features/nightlyBuilds/Component.js | |||
@@ -55,7 +55,7 @@ const styles = () => ({ | |||
55 | }, | 55 | }, |
56 | }); | 56 | }); |
57 | 57 | ||
58 | export default @injectSheet(styles) @inject('stores', 'actions') @observer class nightlyBuildsModal extends Component { | 58 | export default @injectSheet(styles) @inject('stores', 'actions') @observer class NightlyBuildsModal extends Component { |
59 | static contextTypes = { | 59 | static contextTypes = { |
60 | intl: intlShape, | 60 | intl: intlShape, |
61 | }; | 61 | }; |
@@ -124,7 +124,7 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | nightlyBuildsModal.wrappedComponent.propTypes = { | 127 | NightlyBuildsModal.wrappedComponent.propTypes = { |
128 | stores: PropTypes.shape({ | 128 | stores: PropTypes.shape({ |
129 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | 129 | settings: PropTypes.instanceOf(SettingsStore).isRequired, |
130 | }).isRequired, | 130 | }).isRequired, |
diff --git a/src/features/quickSwitch/Component.js b/src/features/quickSwitch/Component.js index 812f2c04b..78d5d94a0 100644 --- a/src/features/quickSwitch/Component.js +++ b/src/features/quickSwitch/Component.js | |||
@@ -118,8 +118,12 @@ export default @injectSheet(styles) @inject('stores', 'actions') @observer class | |||
118 | this.openService = this.openService.bind(this); | 118 | this.openService = this.openService.bind(this); |
119 | 119 | ||
120 | reaction( | 120 | reaction( |
121 | () => ModalState.isModalVisible, | 121 | () => ( |
122 | this._handleVisibilityChange, | 122 | ModalState.isModalVisible |
123 | ), | ||
124 | () => { | ||
125 | this._handleVisibilityChange(); | ||
126 | }, | ||
123 | ); | 127 | ); |
124 | } | 128 | } |
125 | 129 | ||
diff --git a/src/features/settingsWS/index.js b/src/features/settingsWS/index.js index 6711296da..7771421d6 100755 --- a/src/features/settingsWS/index.js +++ b/src/features/settingsWS/index.js | |||
@@ -22,8 +22,6 @@ export default function initSettingsWebSocket(stores, actions) { | |||
22 | settingsStore.stop(); | 22 | settingsStore.stop(); |
23 | } | 23 | } |
24 | }, | 24 | }, |
25 | { | 25 | { fireImmediately: true }, |
26 | fireImmediately: true, | ||
27 | }, | ||
28 | ); | 26 | ); |
29 | } | 27 | } |
diff --git a/src/features/shareFranz/Component.js b/src/features/shareFranz/Component.js deleted file mode 100644 index cc2e81b70..000000000 --- a/src/features/shareFranz/Component.js +++ /dev/null | |||
@@ -1,159 +0,0 @@ | |||
1 | import React, { 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, intlShape } from 'react-intl'; | ||
6 | import { Button } from '@meetfranz/forms'; | ||
7 | import { H1, Icon } from '@meetfranz/ui'; | ||
8 | |||
9 | import { | ||
10 | mdiHeart, mdiEmail, mdiFacebookBox, mdiTwitter, | ||
11 | } from '@mdi/js'; | ||
12 | import Modal from '../../components/ui/Modal'; | ||
13 | import { state } from './store'; | ||
14 | import ServicesStore from '../../stores/ServicesStore'; | ||
15 | |||
16 | const messages = defineMessages({ | ||
17 | headline: { | ||
18 | id: 'feature.shareFranz.headline', | ||
19 | defaultMessage: '!!!Ferdi is better together!', | ||
20 | }, | ||
21 | text: { | ||
22 | id: 'feature.shareFranz.text', | ||
23 | defaultMessage: '!!!Tell your friends and colleagues how awesome Ferdi is and help us to spread the word.', | ||
24 | }, | ||
25 | actionsEmail: { | ||
26 | id: 'feature.shareFranz.action.email', | ||
27 | defaultMessage: '!!!Share as email', | ||
28 | }, | ||
29 | actionsFacebook: { | ||
30 | id: 'feature.shareFranz.action.facebook', | ||
31 | defaultMessage: '!!!Share on Facebook', | ||
32 | }, | ||
33 | actionsTwitter: { | ||
34 | id: 'feature.shareFranz.action.twitter', | ||
35 | defaultMessage: '!!!Share on Twitter', | ||
36 | }, | ||
37 | shareTextEmail: { | ||
38 | id: 'feature.shareFranz.shareText.email', | ||
39 | defaultMessage: '!!! I\'ve added {count} services to Ferdi! Get the free app for WhatsApp, Messenger, Slack, Skype and co at www.meetfranz.com', | ||
40 | }, | ||
41 | shareTextTwitter: { | ||
42 | id: 'feature.shareFranz.shareText.twitter', | ||
43 | defaultMessage: '!!! I\'ve added {count} services to Ferdi! Get the free app for WhatsApp, Messenger, Slack, Skype and co at www.meetfranz.com /cc @FranzMessenger', | ||
44 | }, | ||
45 | }); | ||
46 | |||
47 | const styles = (theme) => ({ | ||
48 | modal: { | ||
49 | width: '80%', | ||
50 | maxWidth: 600, | ||
51 | background: theme.styleTypes.primary.accent, | ||
52 | textAlign: 'center', | ||
53 | color: theme.styleTypes.primary.contrast, | ||
54 | }, | ||
55 | heartContainer: { | ||
56 | display: 'flex', | ||
57 | justifyContent: 'center', | ||
58 | borderRadius: '100%', | ||
59 | background: theme.brandDanger, | ||
60 | padding: 20, | ||
61 | width: 100, | ||
62 | height: 100, | ||
63 | margin: [-70, 'auto', 30], | ||
64 | }, | ||
65 | heart: { | ||
66 | fill: theme.styleTypes.primary.contrast, | ||
67 | }, | ||
68 | headline: { | ||
69 | textAlign: 'center', | ||
70 | fontSize: 40, | ||
71 | marginBottom: 20, | ||
72 | }, | ||
73 | actions: { | ||
74 | display: 'flex', | ||
75 | justifyContent: 'space-between', | ||
76 | marginTop: 30, | ||
77 | }, | ||
78 | cta: { | ||
79 | background: theme.styleTypes.primary.contrast, | ||
80 | color: `${theme.styleTypes.primary.accent} !important`, | ||
81 | |||
82 | '& svg': { | ||
83 | fill: theme.styleTypes.primary.accent, | ||
84 | }, | ||
85 | }, | ||
86 | }); | ||
87 | |||
88 | export default @injectSheet(styles) @inject('stores') @observer class ShareFranzModal extends Component { | ||
89 | static propTypes = { | ||
90 | classes: PropTypes.object.isRequired, | ||
91 | }; | ||
92 | |||
93 | static contextTypes = { | ||
94 | intl: intlShape, | ||
95 | }; | ||
96 | |||
97 | close() { | ||
98 | state.isModalVisible = false; | ||
99 | } | ||
100 | |||
101 | render() { | ||
102 | const { isModalVisible } = state; | ||
103 | |||
104 | const { | ||
105 | classes, | ||
106 | stores, | ||
107 | } = this.props; | ||
108 | |||
109 | const serviceCount = stores.services.all.length; | ||
110 | |||
111 | const { intl } = this.context; | ||
112 | |||
113 | return ( | ||
114 | <Modal | ||
115 | isOpen={isModalVisible} | ||
116 | className={classes.modal} | ||
117 | shouldCloseOnOverlayClick | ||
118 | close={this.close.bind(this)} | ||
119 | > | ||
120 | <div className={classes.heartContainer}> | ||
121 | <Icon icon={mdiHeart} className={classes.heart} size={4} /> | ||
122 | </div> | ||
123 | <H1 className={classes.headline}> | ||
124 | {intl.formatMessage(messages.headline)} | ||
125 | </H1> | ||
126 | <p>{intl.formatMessage(messages.text)}</p> | ||
127 | <div className={classes.actions}> | ||
128 | <Button | ||
129 | label={intl.formatMessage(messages.actionsEmail)} | ||
130 | className={classes.cta} | ||
131 | icon={mdiEmail} | ||
132 | href={`mailto:?subject=Meet the cool app Franz&body=${intl.formatMessage(messages.shareTextEmail, { count: serviceCount })}}`} | ||
133 | target="_blank" | ||
134 | /> | ||
135 | <Button | ||
136 | label={intl.formatMessage(messages.actionsFacebook)} | ||
137 | className={classes.cta} | ||
138 | icon={mdiFacebookBox} | ||
139 | href="https://www.facebook.com/sharer/sharer.php?u=https://www.meetfranz.com?utm_source=facebook&utm_medium=referral&utm_campaign=share-button" | ||
140 | target="_blank" | ||
141 | /> | ||
142 | <Button | ||
143 | label={intl.formatMessage(messages.actionsTwitter)} | ||
144 | className={classes.cta} | ||
145 | icon={mdiTwitter} | ||
146 | href={`http://twitter.com/intent/tweet?status=${intl.formatMessage(messages.shareTextTwitter, { count: serviceCount })}`} | ||
147 | target="_blank" | ||
148 | /> | ||
149 | </div> | ||
150 | </Modal> | ||
151 | ); | ||
152 | } | ||
153 | } | ||
154 | |||
155 | ShareFranzModal.wrappedComponent.propTypes = { | ||
156 | stores: PropTypes.shape({ | ||
157 | services: PropTypes.instanceOf(ServicesStore).isRequired, | ||
158 | }).isRequired, | ||
159 | }; | ||
diff --git a/src/features/shareFranz/index.js b/src/features/shareFranz/index.js deleted file mode 100644 index 9add0f65e..000000000 --- a/src/features/shareFranz/index.js +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | import { reaction } from 'mobx'; | ||
2 | import ms from 'ms'; | ||
3 | import { state as ModalState } from './store'; | ||
4 | |||
5 | export { default as Component } from './Component'; | ||
6 | |||
7 | const debug = require('debug')('Ferdi:feature:shareFranz'); | ||
8 | |||
9 | const state = ModalState; | ||
10 | |||
11 | export default function initialize(stores) { | ||
12 | debug('Initialize shareFerdi feature'); | ||
13 | |||
14 | window.ferdi.features.shareFerdi = { | ||
15 | state, | ||
16 | }; | ||
17 | |||
18 | function showModal() { | ||
19 | debug('Would have showed share window'); | ||
20 | } | ||
21 | |||
22 | reaction( | ||
23 | () => stores.user.isLoggedIn, | ||
24 | () => { | ||
25 | setTimeout(() => { | ||
26 | if (stores.settings.stats.appStarts % 50 === 0) { | ||
27 | showModal(); | ||
28 | } | ||
29 | }, ms('2s')); | ||
30 | }, | ||
31 | { | ||
32 | fireImmediately: true, | ||
33 | }, | ||
34 | ); | ||
35 | } | ||
diff --git a/src/features/shareFranz/store.js b/src/features/shareFranz/store.js deleted file mode 100644 index c637e9eff..000000000 --- a/src/features/shareFranz/store.js +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | import { observable } from 'mobx'; | ||
2 | |||
3 | const defaultState = { | ||
4 | isModalVisible: false, | ||
5 | lastShown: null, | ||
6 | }; | ||
7 | |||
8 | export const state = observable(defaultState); | ||
diff --git a/src/features/todos/index.js b/src/features/todos/index.js index 1c6c9179a..55956d1d7 100644 --- a/src/features/todos/index.js +++ b/src/features/todos/index.js | |||
@@ -13,7 +13,9 @@ export default function initTodos(stores, actions) { | |||
13 | 13 | ||
14 | // Toggle todos feature | 14 | // Toggle todos feature |
15 | reaction( | 15 | reaction( |
16 | () => features.features.isTodosEnabled, | 16 | () => ( |
17 | features.features.isTodosEnabled | ||
18 | ), | ||
17 | (isEnabled) => { | 19 | (isEnabled) => { |
18 | if (isEnabled) { | 20 | if (isEnabled) { |
19 | debug('Initializing `todos` feature'); | 21 | debug('Initializing `todos` feature'); |
@@ -23,8 +25,6 @@ export default function initTodos(stores, actions) { | |||
23 | todosStore.stop(); | 25 | todosStore.stop(); |
24 | } | 26 | } |
25 | }, | 27 | }, |
26 | { | 28 | { fireImmediately: true }, |
27 | fireImmediately: true, | ||
28 | }, | ||
29 | ); | 29 | ); |
30 | } | 30 | } |
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index fff607330..252158364 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js | |||
@@ -5,7 +5,7 @@ import { observer } from 'mobx-react'; | |||
5 | import injectSheet from 'react-jss'; | 5 | import injectSheet from 'react-jss'; |
6 | import classnames from 'classnames'; | 6 | import classnames from 'classnames'; |
7 | import { defineMessages, intlShape } from 'react-intl'; | 7 | import { defineMessages, intlShape } from 'react-intl'; |
8 | import { altKey, shortcutKey } from '../../../environment'; | 8 | import { altKey, cmdOrCtrlShortcutKey } from '../../../environment'; |
9 | 9 | ||
10 | const messages = defineMessages({ | 10 | const messages = defineMessages({ |
11 | noServicesAddedYet: { | 11 | noServicesAddedYet: { |
@@ -125,7 +125,7 @@ class WorkspaceDrawerItem extends Component { | |||
125 | onContextMenuEditClick && contextMenu.popup(getCurrentWindow()) | 125 | onContextMenuEditClick && contextMenu.popup(getCurrentWindow()) |
126 | } | 126 | } |
127 | data-tip={`${ | 127 | data-tip={`${ |
128 | shortcutIndex <= 9 ? `(${shortcutKey(false)}+${altKey}+${shortcutIndex})` : '' | 128 | shortcutIndex <= 9 ? `(${cmdOrCtrlShortcutKey(false)}+${altKey(false)}+${shortcutIndex})` : '' |
129 | }`} | 129 | }`} |
130 | > | 130 | > |
131 | <span | 131 | <span |
diff --git a/src/features/workspaces/index.js b/src/features/workspaces/index.js index 3db6de5b2..83e4d9049 100644 --- a/src/features/workspaces/index.js +++ b/src/features/workspaces/index.js | |||
@@ -12,7 +12,9 @@ export default function initWorkspaces(stores, actions) { | |||
12 | 12 | ||
13 | // Toggle workspace feature | 13 | // Toggle workspace feature |
14 | reaction( | 14 | reaction( |
15 | () => features.features.isWorkspaceEnabled, | 15 | () => ( |
16 | features.features.isWorkspaceEnabled | ||
17 | ), | ||
16 | (isEnabled) => { | 18 | (isEnabled) => { |
17 | if (isEnabled && !workspaceStore.isFeatureActive) { | 19 | if (isEnabled && !workspaceStore.isFeatureActive) { |
18 | debug('Initializing `workspaces` feature'); | 20 | debug('Initializing `workspaces` feature'); |
@@ -23,8 +25,6 @@ export default function initWorkspaces(stores, actions) { | |||
23 | resetApiRequests(); | 25 | resetApiRequests(); |
24 | } | 26 | } |
25 | }, | 27 | }, |
26 | { | 28 | { fireImmediately: true }, |
27 | fireImmediately: true, | ||
28 | }, | ||
29 | ); | 29 | ); |
30 | } | 30 | } |