diff options
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/auth/AuthLayout.js | 2 | ||||
-rw-r--r-- | src/components/auth/Login.js | 4 | ||||
-rw-r--r-- | src/components/layout/AppLayout.js | 23 | ||||
-rw-r--r-- | src/components/layout/Sidebar.js | 37 | ||||
-rw-r--r-- | src/components/services/content/ServiceWebview.js | 20 | ||||
-rw-r--r-- | src/components/services/tabs/TabBarSortableList.js | 3 | ||||
-rw-r--r-- | src/components/services/tabs/TabItem.js | 18 | ||||
-rw-r--r-- | src/components/services/tabs/Tabbar.js | 3 | ||||
-rw-r--r-- | src/components/settings/navigation/SettingsNavigation.js | 21 | ||||
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.js | 21 | ||||
-rw-r--r-- | src/components/ui/Button.js | 95 | ||||
-rw-r--r-- | src/components/ui/Button.tsx | 73 |
12 files changed, 191 insertions, 129 deletions
diff --git a/src/components/auth/AuthLayout.js b/src/components/auth/AuthLayout.js index 00eded728..047b10775 100644 --- a/src/components/auth/AuthLayout.js +++ b/src/components/auth/AuthLayout.js | |||
@@ -54,7 +54,7 @@ class AuthLayout extends Component { | |||
54 | <> | 54 | <> |
55 | {isWindows && !isFullScreen && ( | 55 | {isWindows && !isFullScreen && ( |
56 | <TitleBar | 56 | <TitleBar |
57 | menu={window.ferdi.menu.template} | 57 | menu={window['ferdi'].menu.template} |
58 | icon="assets/images/logo.svg" | 58 | icon="assets/images/logo.svg" |
59 | /> | 59 | /> |
60 | )} | 60 | )} |
diff --git a/src/components/auth/Login.js b/src/components/auth/Login.js index 9f3f636e3..6ed89afb6 100644 --- a/src/components/auth/Login.js +++ b/src/components/auth/Login.js | |||
@@ -168,12 +168,12 @@ class Login extends Component { | |||
168 | <p className="error-message center"> | 168 | <p className="error-message center"> |
169 | {intl.formatMessage(messages.invalidCredentials)} | 169 | {intl.formatMessage(messages.invalidCredentials)} |
170 | </p> | 170 | </p> |
171 | {window.ferdi.stores.settings.all.app.server !== | 171 | {window['ferdi'].stores.settings.all.app.server !== |
172 | LIVE_FRANZ_API && ( | 172 | LIVE_FRANZ_API && ( |
173 | <p className="error-message center"> | 173 | <p className="error-message center"> |
174 | {intl.formatMessage(messages.customServerQuestion)}{' '} | 174 | {intl.formatMessage(messages.customServerQuestion)}{' '} |
175 | <Link | 175 | <Link |
176 | to={`${window.ferdi.stores.settings.all.app.server.replace( | 176 | to={`${window['ferdi'].stores.settings.all.app.server.replace( |
177 | API_VERSION, | 177 | API_VERSION, |
178 | '', | 178 | '', |
179 | )}/import`} | 179 | )}/import`} |
diff --git a/src/components/layout/AppLayout.js b/src/components/layout/AppLayout.js index 4bacc547b..af27e8854 100644 --- a/src/components/layout/AppLayout.js +++ b/src/components/layout/AppLayout.js | |||
@@ -4,6 +4,7 @@ import { observer } from 'mobx-react'; | |||
4 | import { defineMessages, injectIntl } from 'react-intl'; | 4 | import { defineMessages, injectIntl } from 'react-intl'; |
5 | import { TitleBar } from 'electron-react-titlebar/renderer'; | 5 | import { TitleBar } from 'electron-react-titlebar/renderer'; |
6 | import injectSheet from 'react-jss'; | 6 | import injectSheet from 'react-jss'; |
7 | import { ipcRenderer } from 'electron'; | ||
7 | 8 | ||
8 | import InfoBar from '../ui/InfoBar'; | 9 | import InfoBar from '../ui/InfoBar'; |
9 | import { Component as BasicAuth } from '../../features/basicAuth'; | 10 | import { Component as BasicAuth } from '../../features/basicAuth'; |
@@ -14,7 +15,7 @@ import ErrorBoundary from '../util/ErrorBoundary'; | |||
14 | 15 | ||
15 | // import globalMessages from '../../i18n/globalMessages'; | 16 | // import globalMessages from '../../i18n/globalMessages'; |
16 | 17 | ||
17 | import { isWindows } from '../../environment'; | 18 | import { isWindows, isMac } from '../../environment'; |
18 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; | 19 | import WorkspaceSwitchingIndicator from '../../features/workspaces/components/WorkspaceSwitchingIndicator'; |
19 | import { workspaceStore } from '../../features/workspaces'; | 20 | import { workspaceStore } from '../../features/workspaces'; |
20 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; | 21 | import AppUpdateInfoBar from '../AppUpdateInfoBar'; |
@@ -57,8 +58,20 @@ const styles = theme => ({ | |||
57 | : `translateX(-${theme.workspaces.drawer.width}px)`; | 58 | : `translateX(-${theme.workspaces.drawer.width}px)`; |
58 | }, | 59 | }, |
59 | }, | 60 | }, |
61 | titleBar: { | ||
62 | display: 'block', | ||
63 | zIndex: 1, | ||
64 | width: '100%', | ||
65 | height: '23px', | ||
66 | position: 'absolute', | ||
67 | top: 0, | ||
68 | }, | ||
60 | }); | 69 | }); |
61 | 70 | ||
71 | const toggleFullScreen = () => { | ||
72 | ipcRenderer.send('window.toolbar-double-clicked'); | ||
73 | }; | ||
74 | |||
62 | @injectSheet(styles) | 75 | @injectSheet(styles) |
63 | @observer | 76 | @observer |
64 | class AppLayout extends Component { | 77 | class AppLayout extends Component { |
@@ -115,10 +128,16 @@ class AppLayout extends Component { | |||
115 | <div className="app"> | 128 | <div className="app"> |
116 | {isWindows && !isFullScreen && ( | 129 | {isWindows && !isFullScreen && ( |
117 | <TitleBar | 130 | <TitleBar |
118 | menu={window.ferdi.menu.template} | 131 | menu={window['ferdi'].menu.template} |
119 | icon="assets/images/logo.svg" | 132 | icon="assets/images/logo.svg" |
120 | /> | 133 | /> |
121 | )} | 134 | )} |
135 | {isMac && !isFullScreen && ( | ||
136 | <span | ||
137 | onDoubleClick={toggleFullScreen} | ||
138 | className={classes.titleBar} | ||
139 | /> | ||
140 | )} | ||
122 | <div className={`app__content ${classes.appContent}`}> | 141 | <div className={`app__content ${classes.appContent}`}> |
123 | {workspacesDrawer} | 142 | {workspacesDrawer} |
124 | {sidebar} | 143 | {sidebar} |
diff --git a/src/components/layout/Sidebar.js b/src/components/layout/Sidebar.js index fc33a3c58..18492be80 100644 --- a/src/components/layout/Sidebar.js +++ b/src/components/layout/Sidebar.js | |||
@@ -14,7 +14,6 @@ import { | |||
14 | addNewServiceShortcutKey, | 14 | addNewServiceShortcutKey, |
15 | muteFerdiShortcutKey, | 15 | muteFerdiShortcutKey, |
16 | } from '../../environment'; | 16 | } from '../../environment'; |
17 | import { workspaceStore } from '../../features/workspaces'; | ||
18 | import { todosStore } from '../../features/todos'; | 17 | import { todosStore } from '../../features/todos'; |
19 | import { todoActions } from '../../features/todos/actions'; | 18 | import { todoActions } from '../../features/todos/actions'; |
20 | import AppStore from '../../stores/AppStore'; | 19 | import AppStore from '../../stores/AppStore'; |
@@ -69,6 +68,7 @@ class Sidebar extends Component { | |||
69 | toggleAudio: PropTypes.func.isRequired, | 68 | toggleAudio: PropTypes.func.isRequired, |
70 | toggleDarkMode: PropTypes.func.isRequired, | 69 | toggleDarkMode: PropTypes.func.isRequired, |
71 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, | 70 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, |
71 | showServiceNameSetting: PropTypes.bool.isRequired, | ||
72 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, | 72 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, |
73 | deleteService: PropTypes.func.isRequired, | 73 | deleteService: PropTypes.func.isRequired, |
74 | updateService: PropTypes.func.isRequired, | 74 | updateService: PropTypes.func.isRequired, |
@@ -159,8 +159,7 @@ class Sidebar extends Component { | |||
159 | <i className="mdi mdi-lock" /> | 159 | <i className="mdi mdi-lock" /> |
160 | </button> | 160 | </button> |
161 | ) : null} | 161 | ) : null} |
162 | {todosStore.isFeatureEnabled && | 162 | {todosStore.isFeatureEnabledByUser ? ( |
163 | todosStore.isFeatureEnabledByUser ? ( | ||
164 | <button | 163 | <button |
165 | type="button" | 164 | type="button" |
166 | onClick={() => { | 165 | onClick={() => { |
@@ -178,23 +177,21 @@ class Sidebar extends Component { | |||
178 | <i className="mdi mdi-check-all" /> | 177 | <i className="mdi mdi-check-all" /> |
179 | </button> | 178 | </button> |
180 | ) : null} | 179 | ) : null} |
181 | {workspaceStore.isFeatureEnabled ? ( | 180 | <button |
182 | <button | 181 | type="button" |
183 | type="button" | 182 | onClick={() => { |
184 | onClick={() => { | 183 | toggleWorkspaceDrawer(); |
185 | toggleWorkspaceDrawer(); | 184 | this.updateToolTip(); |
186 | this.updateToolTip(); | 185 | }} |
187 | }} | 186 | className={`sidebar__button sidebar__button--workspaces ${ |
188 | className={`sidebar__button sidebar__button--workspaces ${ | 187 | isWorkspaceDrawerOpen ? 'is-active' : '' |
189 | isWorkspaceDrawerOpen ? 'is-active' : '' | 188 | }`} |
190 | }`} | 189 | data-tip={`${intl.formatMessage( |
191 | data-tip={`${intl.formatMessage( | 190 | workspaceToggleMessage, |
192 | workspaceToggleMessage, | 191 | )} (${workspaceToggleShortcutKey(false)})`} |
193 | )} (${workspaceToggleShortcutKey(false)})`} | 192 | > |
194 | > | 193 | <i className="mdi mdi-view-grid" /> |
195 | <i className="mdi mdi-view-grid" /> | 194 | </button> |
196 | </button> | ||
197 | ) : null} | ||
198 | <button | 195 | <button |
199 | type="button" | 196 | type="button" |
200 | onClick={() => { | 197 | onClick={() => { |
diff --git a/src/components/services/content/ServiceWebview.js b/src/components/services/content/ServiceWebview.js index 185d41175..2562c09ce 100644 --- a/src/components/services/content/ServiceWebview.js +++ b/src/components/services/content/ServiceWebview.js | |||
@@ -30,9 +30,14 @@ class ServiceWebview extends Component { | |||
30 | this.webview.view.addEventListener('console-message', e => { | 30 | this.webview.view.addEventListener('console-message', e => { |
31 | debug('Service logged a message:', e.message); | 31 | debug('Service logged a message:', e.message); |
32 | }); | 32 | }); |
33 | this.webview.view.addEventListener('did-navigate', () => { | ||
34 | document.title = `Ferdi - ${this.props.service.name} ${this.props.service.dialogTitle | ||
35 | ? ` - ${this.props.service.dialogTitle}` | ||
36 | : '' | ||
37 | } ${`- ${this.props.service._webview.getTitle()}`}`; | ||
38 | }) | ||
33 | } | 39 | } |
34 | }, | 40 | }) |
35 | ); | ||
36 | } | 41 | } |
37 | 42 | ||
38 | componentWillUnmount() { | 43 | componentWillUnmount() { |
@@ -47,6 +52,12 @@ class ServiceWebview extends Component { | |||
47 | if (this.props.service.isActive) { | 52 | if (this.props.service.isActive) { |
48 | webview.view.blur(); | 53 | webview.view.blur(); |
49 | webview.view.focus(); | 54 | webview.view.focus(); |
55 | window.setTimeout(() => { | ||
56 | document.title = `Ferdi - ${this.props.service.name} ${this.props.service.dialogTitle | ||
57 | ? ` - ${this.props.service.dialogTitle}` | ||
58 | : '' | ||
59 | } ${`- ${this.props.service._webview.getTitle()}`}`; | ||
60 | }, 100); | ||
50 | } else { | 61 | } else { |
51 | debug('Refocus not required - Not active service'); | 62 | debug('Refocus not required - Not active service'); |
52 | } | 63 | } |
@@ -92,9 +103,8 @@ class ServiceWebview extends Component { | |||
92 | } | 103 | } |
93 | allowpopups | 104 | allowpopups |
94 | nodeintegration | 105 | nodeintegration |
95 | webpreferences={`spellcheck=${ | 106 | webpreferences={`spellcheck=${isSpellcheckerEnabled ? 1 : 0 |
96 | isSpellcheckerEnabled ? 1 : 0 | 107 | }, contextIsolation=1, enableRemoteModule=1`} |
97 | }, contextIsolation=1, enableRemoteModule=1`} | ||
98 | /> | 108 | /> |
99 | ); | 109 | ); |
100 | } | 110 | } |
diff --git a/src/components/services/tabs/TabBarSortableList.js b/src/components/services/tabs/TabBarSortableList.js index 69a12e982..3049b6efa 100644 --- a/src/components/services/tabs/TabBarSortableList.js +++ b/src/components/services/tabs/TabBarSortableList.js | |||
@@ -21,6 +21,7 @@ class TabBarSortableList extends Component { | |||
21 | hibernateService: PropTypes.func.isRequired, | 21 | hibernateService: PropTypes.func.isRequired, |
22 | wakeUpService: PropTypes.func.isRequired, | 22 | wakeUpService: PropTypes.func.isRequired, |
23 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, | 23 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, |
24 | showServiceNameSetting: PropTypes.bool.isRequired, | ||
24 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, | 25 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, |
25 | }; | 26 | }; |
26 | 27 | ||
@@ -39,6 +40,7 @@ class TabBarSortableList extends Component { | |||
39 | wakeUpService, | 40 | wakeUpService, |
40 | openSettings, | 41 | openSettings, |
41 | showMessageBadgeWhenMutedSetting, | 42 | showMessageBadgeWhenMutedSetting, |
43 | showServiceNameSetting, | ||
42 | showMessageBadgesEvenWhenMuted, | 44 | showMessageBadgesEvenWhenMuted, |
43 | } = this.props; | 45 | } = this.props; |
44 | 46 | ||
@@ -65,6 +67,7 @@ class TabBarSortableList extends Component { | |||
65 | openSettings={openSettings} | 67 | openSettings={openSettings} |
66 | showMessageBadgeWhenMutedSetting={showMessageBadgeWhenMutedSetting} | 68 | showMessageBadgeWhenMutedSetting={showMessageBadgeWhenMutedSetting} |
67 | showMessageBadgesEvenWhenMuted={showMessageBadgesEvenWhenMuted} | 69 | showMessageBadgesEvenWhenMuted={showMessageBadgesEvenWhenMuted} |
70 | showServiceNameSetting={showServiceNameSetting} | ||
68 | /> | 71 | /> |
69 | ))} | 72 | ))} |
70 | </ul> | 73 | </ul> |
diff --git a/src/components/services/tabs/TabItem.js b/src/components/services/tabs/TabItem.js index ed8430b89..3ea6c5da2 100644 --- a/src/components/services/tabs/TabItem.js +++ b/src/components/services/tabs/TabItem.js | |||
@@ -132,6 +132,7 @@ class TabItem extends Component { | |||
132 | hibernateService: PropTypes.func.isRequired, | 132 | hibernateService: PropTypes.func.isRequired, |
133 | wakeUpService: PropTypes.func.isRequired, | 133 | wakeUpService: PropTypes.func.isRequired, |
134 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, | 134 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, |
135 | showServiceNameSetting: PropTypes.bool.isRequired, | ||
135 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, | 136 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, |
136 | stores: PropTypes.shape({ | 137 | stores: PropTypes.shape({ |
137 | settings: PropTypes.instanceOf(SettingsStore).isRequired, | 138 | settings: PropTypes.instanceOf(SettingsStore).isRequired, |
@@ -219,6 +220,7 @@ class TabItem extends Component { | |||
219 | wakeUpService, | 220 | wakeUpService, |
220 | openSettings, | 221 | openSettings, |
221 | showMessageBadgeWhenMutedSetting, | 222 | showMessageBadgeWhenMutedSetting, |
223 | showServiceNameSetting, | ||
222 | showMessageBadgesEvenWhenMuted, | 224 | showMessageBadgesEvenWhenMuted, |
223 | } = this.props; | 225 | } = this.props; |
224 | const { intl } = this.props; | 226 | const { intl } = this.props; |
@@ -331,6 +333,13 @@ class TabItem extends Component { | |||
331 | ); | 333 | ); |
332 | } | 334 | } |
333 | 335 | ||
336 | let errorBadge = null; | ||
337 | if ( service.isError ) { | ||
338 | errorBadge=( | ||
339 | <i className = " mdi mdi-exclamation tab-item__error-icon"/> | ||
340 | ) | ||
341 | } | ||
342 | |||
334 | return ( | 343 | return ( |
335 | <li | 344 | <li |
336 | className={classnames({ | 345 | className={classnames({ |
@@ -340,6 +349,7 @@ class TabItem extends Component { | |||
340 | 'is-active': service.isActive, | 349 | 'is-active': service.isActive, |
341 | 'has-custom-icon': service.hasCustomIcon, | 350 | 'has-custom-icon': service.hasCustomIcon, |
342 | 'is-disabled': !service.isEnabled, | 351 | 'is-disabled': !service.isEnabled, |
352 | 'is-label-enabled': showServiceNameSetting, | ||
343 | })} | 353 | })} |
344 | onClick={clickHandler} | 354 | onClick={clickHandler} |
345 | onContextMenu={() => menu.popup()} | 355 | onContextMenu={() => menu.popup()} |
@@ -349,8 +359,14 @@ class TabItem extends Component { | |||
349 | : '' | 359 | : '' |
350 | }`} | 360 | }`} |
351 | > | 361 | > |
352 | <img src={service.icon} className="tab-item__icon" alt="" /> | 362 | |
363 | {showServiceNameSetting? <div> | ||
364 | <img src={service.icon} className="tab-item__icon" alt="" /> | ||
365 | <span className="tab-item__label">{service.name}</span> | ||
366 | </div> : <img src={service.icon} className="tab-item__icon" alt="" />} | ||
367 | |||
353 | {notificationBadge} | 368 | {notificationBadge} |
369 | {errorBadge} | ||
354 | {IS_SERVICE_DEBUGGING_ENABLED && ( | 370 | {IS_SERVICE_DEBUGGING_ENABLED && ( |
355 | <> | 371 | <> |
356 | <div | 372 | <div |
diff --git a/src/components/services/tabs/Tabbar.js b/src/components/services/tabs/Tabbar.js index 4ab0e8611..94d6f33c1 100644 --- a/src/components/services/tabs/Tabbar.js +++ b/src/components/services/tabs/Tabbar.js | |||
@@ -23,6 +23,7 @@ class TabBar extends Component { | |||
23 | wakeUpService: PropTypes.func.isRequired, | 23 | wakeUpService: PropTypes.func.isRequired, |
24 | useVerticalStyle: PropTypes.bool.isRequired, | 24 | useVerticalStyle: PropTypes.bool.isRequired, |
25 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, | 25 | showMessageBadgeWhenMutedSetting: PropTypes.bool.isRequired, |
26 | showServiceNameSetting: PropTypes.bool.isRequired, | ||
26 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, | 27 | showMessageBadgesEvenWhenMuted: PropTypes.bool.isRequired, |
27 | }; | 28 | }; |
28 | 29 | ||
@@ -82,6 +83,7 @@ class TabBar extends Component { | |||
82 | deleteService, | 83 | deleteService, |
83 | useVerticalStyle, | 84 | useVerticalStyle, |
84 | showMessageBadgeWhenMutedSetting, | 85 | showMessageBadgeWhenMutedSetting, |
86 | showServiceNameSetting, | ||
85 | showMessageBadgesEvenWhenMuted, | 87 | showMessageBadgesEvenWhenMuted, |
86 | } = this.props; | 88 | } = this.props; |
87 | 89 | ||
@@ -110,6 +112,7 @@ class TabBar extends Component { | |||
110 | lockAxis={axis} | 112 | lockAxis={axis} |
111 | helperClass="is-reordering" | 113 | helperClass="is-reordering" |
112 | showMessageBadgeWhenMutedSetting={showMessageBadgeWhenMutedSetting} | 114 | showMessageBadgeWhenMutedSetting={showMessageBadgeWhenMutedSetting} |
115 | showServiceNameSetting={showServiceNameSetting} | ||
113 | showMessageBadgesEvenWhenMuted={showMessageBadgesEvenWhenMuted} | 116 | showMessageBadgesEvenWhenMuted={showMessageBadgesEvenWhenMuted} |
114 | /> | 117 | /> |
115 | </div> | 118 | </div> |
diff --git a/src/components/settings/navigation/SettingsNavigation.js b/src/components/settings/navigation/SettingsNavigation.js index 18a71fdeb..dbb1365b0 100644 --- a/src/components/settings/navigation/SettingsNavigation.js +++ b/src/components/settings/navigation/SettingsNavigation.js | |||
@@ -6,7 +6,6 @@ import { RouterStore } from 'mobx-react-router'; | |||
6 | 6 | ||
7 | import { LOCAL_SERVER, LIVE_FERDI_API, LIVE_FRANZ_API } from '../../../config'; | 7 | import { LOCAL_SERVER, LIVE_FERDI_API, LIVE_FRANZ_API } from '../../../config'; |
8 | import Link from '../../ui/Link'; | 8 | import Link from '../../ui/Link'; |
9 | import { workspaceStore } from '../../../features/workspaces'; | ||
10 | import UIStore from '../../../stores/UIStore'; | 9 | import UIStore from '../../../stores/UIStore'; |
11 | import SettingsStore from '../../../stores/SettingsStore'; | 10 | import SettingsStore from '../../../stores/SettingsStore'; |
12 | import UserStore from '../../../stores/UserStore'; | 11 | import UserStore from '../../../stores/UserStore'; |
@@ -117,17 +116,15 @@ class SettingsNavigation extends Component { | |||
117 | {intl.formatMessage(messages.yourServices)}{' '} | 116 | {intl.formatMessage(messages.yourServices)}{' '} |
118 | <span className="badge">{serviceCount}</span> | 117 | <span className="badge">{serviceCount}</span> |
119 | </Link> | 118 | </Link> |
120 | {workspaceStore.isFeatureEnabled ? ( | 119 | <Link |
121 | <Link | 120 | to="/settings/workspaces" |
122 | to="/settings/workspaces" | 121 | className="settings-navigation__link" |
123 | className="settings-navigation__link" | 122 | activeClassName="is-active" |
124 | activeClassName="is-active" | 123 | disabled={!isLoggedIn} |
125 | disabled={!isLoggedIn} | 124 | > |
126 | > | 125 | {intl.formatMessage(messages.yourWorkspaces)}{' '} |
127 | {intl.formatMessage(messages.yourWorkspaces)}{' '} | 126 | <span className="badge">{workspaceCount}</span> |
128 | <span className="badge">{workspaceCount}</span> | 127 | </Link> |
129 | </Link> | ||
130 | ) : null} | ||
131 | {!isUsingWithoutAccount && ( | 128 | {!isUsingWithoutAccount && ( |
132 | <Link | 129 | <Link |
133 | to="/settings/user" | 130 | to="/settings/user" |
diff --git a/src/components/settings/settings/EditSettingsForm.js b/src/components/settings/settings/EditSettingsForm.js index 948e9ccd5..54f2025e5 100644 --- a/src/components/settings/settings/EditSettingsForm.js +++ b/src/components/settings/settings/EditSettingsForm.js | |||
@@ -194,9 +194,7 @@ class EditSettingsForm extends Component { | |||
194 | isClearingAllCache: PropTypes.bool.isRequired, | 194 | isClearingAllCache: PropTypes.bool.isRequired, |
195 | onClearAllCache: PropTypes.func.isRequired, | 195 | onClearAllCache: PropTypes.func.isRequired, |
196 | getCacheSize: PropTypes.func.isRequired, | 196 | getCacheSize: PropTypes.func.isRequired, |
197 | isTodosEnabled: PropTypes.bool.isRequired, | ||
198 | isTodosActivated: PropTypes.bool.isRequired, | 197 | isTodosActivated: PropTypes.bool.isRequired, |
199 | isWorkspaceEnabled: PropTypes.bool.isRequired, | ||
200 | automaticUpdates: PropTypes.bool.isRequired, | 198 | automaticUpdates: PropTypes.bool.isRequired, |
201 | isDarkmodeEnabled: PropTypes.bool.isRequired, | 199 | isDarkmodeEnabled: PropTypes.bool.isRequired, |
202 | isAdaptableDarkModeEnabled: PropTypes.bool.isRequired, | 200 | isAdaptableDarkModeEnabled: PropTypes.bool.isRequired, |
@@ -244,8 +242,6 @@ class EditSettingsForm extends Component { | |||
244 | isClearingAllCache, | 242 | isClearingAllCache, |
245 | onClearAllCache, | 243 | onClearAllCache, |
246 | getCacheSize, | 244 | getCacheSize, |
247 | isTodosEnabled, | ||
248 | isWorkspaceEnabled, | ||
249 | automaticUpdates, | 245 | automaticUpdates, |
250 | isDarkmodeEnabled, | 246 | isDarkmodeEnabled, |
251 | isTodosActivated, | 247 | isTodosActivated, |
@@ -265,7 +261,7 @@ class EditSettingsForm extends Component { | |||
265 | } | 261 | } |
266 | 262 | ||
267 | const { lockingFeatureEnabled, scheduledDNDEnabled } = | 263 | const { lockingFeatureEnabled, scheduledDNDEnabled } = |
268 | window.ferdi.stores.settings.all.app; | 264 | window['ferdi'].stores.settings.all.app; |
269 | 265 | ||
270 | let cacheSize; | 266 | let cacheSize; |
271 | let notCleared; | 267 | let notCleared; |
@@ -414,14 +410,12 @@ class EditSettingsForm extends Component { | |||
414 | 410 | ||
415 | <Hr /> | 411 | <Hr /> |
416 | 412 | ||
417 | {isWorkspaceEnabled && ( | 413 | <> |
418 | <> | 414 | <Toggle field={form.$('keepAllWorkspacesLoaded')} /> |
419 | <Toggle field={form.$('keepAllWorkspacesLoaded')} /> | 415 | <Hr /> |
420 | <Hr /> | 416 | </> |
421 | </> | ||
422 | )} | ||
423 | 417 | ||
424 | {isTodosEnabled && !hasAddedTodosAsService && ( | 418 | {!hasAddedTodosAsService && ( |
425 | <> | 419 | <> |
426 | <Toggle field={form.$('enableTodos')} /> | 420 | <Toggle field={form.$('enableTodos')} /> |
427 | {isTodosActivated && ( | 421 | {isTodosActivated && ( |
@@ -511,6 +505,7 @@ class EditSettingsForm extends Component { | |||
511 | {this.state.activeSetttingsTab === 'appearance' && ( | 505 | {this.state.activeSetttingsTab === 'appearance' && ( |
512 | <div> | 506 | <div> |
513 | <Toggle field={form.$('showDisabledServices')} /> | 507 | <Toggle field={form.$('showDisabledServices')} /> |
508 | <Toggle field={form.$('showServiceName')} /> | ||
514 | <Toggle field={form.$('showMessageBadgeWhenMuted')} /> | 509 | <Toggle field={form.$('showMessageBadgeWhenMuted')} /> |
515 | 510 | ||
516 | {isMac && <Toggle field={form.$('showDragArea')} />} | 511 | {isMac && <Toggle field={form.$('showDragArea')} />} |
@@ -768,7 +763,7 @@ class EditSettingsForm extends Component { | |||
768 | name: 'Nightly builds', | 763 | name: 'Nightly builds', |
769 | }} | 764 | }} |
770 | onChange={ | 765 | onChange={ |
771 | window.ferdi.features.nightlyBuilds.toggleFeature | 766 | window['ferdi'].features.nightlyBuilds.toggleFeature |
772 | } | 767 | } |
773 | /> | 768 | /> |
774 | {updateIsReadyToInstall ? ( | 769 | {updateIsReadyToInstall ? ( |
diff --git a/src/components/ui/Button.js b/src/components/ui/Button.js new file mode 100644 index 000000000..67c801d98 --- /dev/null +++ b/src/components/ui/Button.js | |||
@@ -0,0 +1,95 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer, inject } from 'mobx-react'; | ||
4 | import Loader from 'react-loader'; | ||
5 | import classnames from 'classnames'; | ||
6 | |||
7 | @inject('stores') | ||
8 | @observer | ||
9 | class Button extends Component { | ||
10 | static propTypes = { | ||
11 | className: PropTypes.string, | ||
12 | label: PropTypes.string.isRequired, | ||
13 | disabled: PropTypes.bool, | ||
14 | onClick: PropTypes.func, | ||
15 | type: PropTypes.string, | ||
16 | buttonType: PropTypes.string, | ||
17 | loaded: PropTypes.bool, | ||
18 | htmlForm: PropTypes.string, | ||
19 | stores: PropTypes.shape({ | ||
20 | settings: PropTypes.shape({ | ||
21 | app: PropTypes.shape({ | ||
22 | accentColor: PropTypes.string.isRequired, | ||
23 | }).isRequired, | ||
24 | }).isRequired, | ||
25 | }).isRequired, | ||
26 | }; | ||
27 | |||
28 | static defaultProps = { | ||
29 | className: null, | ||
30 | disabled: false, | ||
31 | onClick: () => {}, | ||
32 | type: 'button', | ||
33 | buttonType: '', | ||
34 | loaded: true, | ||
35 | htmlForm: '', | ||
36 | }; | ||
37 | |||
38 | element = null; | ||
39 | |||
40 | render() { | ||
41 | const { | ||
42 | label, | ||
43 | className, | ||
44 | disabled, | ||
45 | onClick, | ||
46 | type, | ||
47 | buttonType, | ||
48 | loaded, | ||
49 | htmlForm, | ||
50 | } = this.props; | ||
51 | |||
52 | const buttonProps = { | ||
53 | className: classnames({ | ||
54 | 'franz-form__button': true, | ||
55 | [`franz-form__button--${buttonType}`]: buttonType, | ||
56 | [`${className}`]: className, | ||
57 | }), | ||
58 | type, | ||
59 | }; | ||
60 | |||
61 | if (disabled) { | ||
62 | buttonProps.disabled = true; | ||
63 | } | ||
64 | |||
65 | if (onClick) { | ||
66 | buttonProps.onClick = onClick; | ||
67 | } | ||
68 | |||
69 | if (htmlForm) { | ||
70 | buttonProps.form = htmlForm; | ||
71 | } | ||
72 | |||
73 | return ( | ||
74 | // disabling rule as button has type defined in `buttonProps` | ||
75 | /* eslint-disable react/button-has-type */ | ||
76 | <button {...buttonProps}> | ||
77 | <Loader | ||
78 | loaded={loaded} | ||
79 | lines={10} | ||
80 | scale={0.4} | ||
81 | color={ | ||
82 | buttonType !== 'secondary' | ||
83 | ? '#FFF' | ||
84 | : this.props.stores.settings.app.accentColor | ||
85 | } | ||
86 | component="span" | ||
87 | /> | ||
88 | {label} | ||
89 | </button> | ||
90 | /* eslint-enable react/button-has-type */ | ||
91 | ); | ||
92 | } | ||
93 | } | ||
94 | |||
95 | export default Button; | ||
diff --git a/src/components/ui/Button.tsx b/src/components/ui/Button.tsx deleted file mode 100644 index aac080fda..000000000 --- a/src/components/ui/Button.tsx +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | import { Component } from 'react'; | ||
2 | import { observer, inject } from 'mobx-react'; | ||
3 | import Loader from 'react-loader'; | ||
4 | import classnames from 'classnames'; | ||
5 | import { FerdiStores } from '../../stores.types'; | ||
6 | |||
7 | type Props = { | ||
8 | className: string; | ||
9 | label: string; | ||
10 | disabled: boolean; | ||
11 | onClick: () => void; | ||
12 | type: 'button' | 'submit' | 'reset'; | ||
13 | buttonType: string; | ||
14 | loaded: boolean; | ||
15 | htmlForm: string; | ||
16 | stores: FerdiStores; | ||
17 | }; | ||
18 | |||
19 | @inject('stores') | ||
20 | @observer | ||
21 | class Button extends Component<Props> { | ||
22 | static defaultProps = { | ||
23 | className: null, | ||
24 | disabled: false, | ||
25 | onClick: () => {}, | ||
26 | type: 'button', | ||
27 | buttonType: '', | ||
28 | loaded: true, | ||
29 | htmlForm: '', | ||
30 | }; | ||
31 | |||
32 | render() { | ||
33 | const { | ||
34 | label, | ||
35 | className, | ||
36 | disabled, | ||
37 | onClick, | ||
38 | type, | ||
39 | buttonType, | ||
40 | loaded, | ||
41 | htmlForm, | ||
42 | } = this.props; | ||
43 | |||
44 | return ( | ||
45 | <button | ||
46 | className={classnames({ | ||
47 | 'franz-form__button': true, | ||
48 | [`franz-form__button--${buttonType}`]: buttonType, | ||
49 | [`${className}`]: className, | ||
50 | })} | ||
51 | disabled={disabled} | ||
52 | type={type} | ||
53 | onClick={onClick} | ||
54 | form={htmlForm} | ||
55 | > | ||
56 | <Loader | ||
57 | loaded={loaded} | ||
58 | lines={10} | ||
59 | scale={0.4} | ||
60 | color={ | ||
61 | buttonType !== 'secondary' | ||
62 | ? '#FFF' | ||
63 | : this.props.stores.settings.app.accentColor | ||
64 | } | ||
65 | component="span" | ||
66 | /> | ||
67 | {label} | ||
68 | </button> | ||
69 | ); | ||
70 | } | ||
71 | } | ||
72 | |||
73 | export default Button; | ||