diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-10-15 09:48:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 09:48:06 +0200 |
commit | 14d2364fc69e0222133115c55a36286986006098 (patch) | |
tree | 9e9b3c41ef742bbe87ca1632b292c67043051957 /src/features/workspaces | |
parent | 5.6.3-nightly.34 [skip ci] (diff) | |
download | ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.gz ferdium-app-14d2364fc69e0222133115c55a36286986006098.tar.zst ferdium-app-14d2364fc69e0222133115c55a36286986006098.zip |
chore: update eslint setup (#2074)
Diffstat (limited to 'src/features/workspaces')
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawerItem.js | 8 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspacesDashboard.js | 3 | ||||
-rw-r--r-- | src/features/workspaces/store.js | 46 |
3 files changed, 34 insertions, 23 deletions
diff --git a/src/features/workspaces/components/WorkspaceDrawerItem.js b/src/features/workspaces/components/WorkspaceDrawerItem.js index 237f9488b..d3c9fa767 100644 --- a/src/features/workspaces/components/WorkspaceDrawerItem.js +++ b/src/features/workspaces/components/WorkspaceDrawerItem.js | |||
@@ -118,14 +118,12 @@ class WorkspaceDrawerItem extends Component { | |||
118 | isActive ? classes.isActiveItem : null, | 118 | isActive ? classes.isActiveItem : null, |
119 | ])} | 119 | ])} |
120 | onClick={onClick} | 120 | onClick={onClick} |
121 | onContextMenu={() => | 121 | onContextMenu={() => onContextMenuEditClick && contextMenu.popup()} |
122 | onContextMenuEditClick && contextMenu.popup() | ||
123 | } | ||
124 | data-tip={`${ | 122 | data-tip={`${ |
125 | shortcutIndex <= 9 | 123 | shortcutIndex <= 9 |
126 | ? `(${cmdOrCtrlShortcutKey(false)}+${altKey( | 124 | ? `(${cmdOrCtrlShortcutKey(false)}+${altKey( |
127 | false, | 125 | false, |
128 | )}+${shortcutIndex})` | 126 | )}+${shortcutIndex})` |
129 | : '' | 127 | : '' |
130 | }`} | 128 | }`} |
131 | > | 129 | > |
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js index 78b758e7d..8ab9174d3 100644 --- a/src/features/workspaces/components/WorkspacesDashboard.js +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -40,7 +40,8 @@ const messages = defineMessages({ | |||
40 | }, | 40 | }, |
41 | workspaceFeatureInfo: { | 41 | workspaceFeatureInfo: { |
42 | id: 'settings.workspaces.workspaceFeatureInfo', | 42 | id: 'settings.workspaces.workspaceFeatureInfo', |
43 | defaultMessage: 'Ferdi Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time. You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.', | 43 | defaultMessage: |
44 | 'Ferdi Workspaces let you focus on what’s important right now. Set up different sets of services and easily switch between them at any time. You decide which services you need when and where, so we can help you stay on top of your game - or easily switch off from work whenever you want.', | ||
44 | }, | 45 | }, |
45 | workspaceFeatureHeadline: { | 46 | workspaceFeatureHeadline: { |
46 | id: 'settings.workspaces.workspaceFeatureHeadline', | 47 | id: 'settings.workspaces.workspaceFeatureHeadline', |
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js index db2b69f99..0fa43b723 100644 --- a/src/features/workspaces/store.js +++ b/src/features/workspaces/store.js | |||
@@ -124,7 +124,7 @@ export default class WorkspacesStore extends FeatureStore { | |||
124 | this.isFeatureActive = false; | 124 | this.isFeatureActive = false; |
125 | } | 125 | } |
126 | 126 | ||
127 | filterServicesByActiveWorkspace = (services) => { | 127 | filterServicesByActiveWorkspace = services => { |
128 | const { activeWorkspace, isFeatureActive } = this; | 128 | const { activeWorkspace, isFeatureActive } = this; |
129 | if (isFeatureActive && activeWorkspace) { | 129 | if (isFeatureActive && activeWorkspace) { |
130 | return this.getWorkspaceServices(activeWorkspace); | 130 | return this.getWorkspaceServices(activeWorkspace); |
@@ -134,14 +134,14 @@ export default class WorkspacesStore extends FeatureStore { | |||
134 | 134 | ||
135 | getWorkspaceServices(workspace) { | 135 | getWorkspaceServices(workspace) { |
136 | const { services } = this.stores; | 136 | const { services } = this.stores; |
137 | return workspace.services.map((id) => services.one(id)).filter((s) => !!s); | 137 | return workspace.services.map(id => services.one(id)).filter(s => !!s); |
138 | } | 138 | } |
139 | 139 | ||
140 | // ========== PRIVATE METHODS ========= // | 140 | // ========== PRIVATE METHODS ========= // |
141 | 141 | ||
142 | _getWorkspaceById = (id) => this.workspaces.find((w) => w.id === id); | 142 | _getWorkspaceById = id => this.workspaces.find(w => w.id === id); |
143 | 143 | ||
144 | _updateSettings = (changes) => { | 144 | _updateSettings = changes => { |
145 | localStorage.setItem('workspaces', { | 145 | localStorage.setItem('workspaces', { |
146 | ...this.settings, | 146 | ...this.settings, |
147 | ...changes, | 147 | ...changes, |
@@ -191,9 +191,15 @@ export default class WorkspacesStore extends FeatureStore { | |||
191 | this.isSwitchingWorkspace = false; | 191 | this.isSwitchingWorkspace = false; |
192 | this.nextWorkspace = null; | 192 | this.nextWorkspace = null; |
193 | if (this.stores.settings.app.splitMode) { | 193 | if (this.stores.settings.app.splitMode) { |
194 | const serviceNames = new Set(this.getWorkspaceServices(workspace).map(service => service.name)); | 194 | const serviceNames = new Set( |
195 | for (const wrapper of document.querySelectorAll('.services__webview-wrapper')) { | 195 | this.getWorkspaceServices(workspace).map(service => service.name), |
196 | wrapper.style.display = serviceNames.has(wrapper.dataset.name) ? '' : 'none'; | 196 | ); |
197 | for (const wrapper of document.querySelectorAll( | ||
198 | '.services__webview-wrapper', | ||
199 | )) { | ||
200 | wrapper.style.display = serviceNames.has(wrapper.dataset.name) | ||
201 | ? '' | ||
202 | : 'none'; | ||
197 | } | 203 | } |
198 | } | 204 | } |
199 | }, 1000); | 205 | }, 1000); |
@@ -212,7 +218,9 @@ export default class WorkspacesStore extends FeatureStore { | |||
212 | setTimeout(() => { | 218 | setTimeout(() => { |
213 | this.isSwitchingWorkspace = false; | 219 | this.isSwitchingWorkspace = false; |
214 | if (this.stores.settings.app.splitMode) { | 220 | if (this.stores.settings.app.splitMode) { |
215 | for (const wrapper of document.querySelectorAll('.services__webview-wrapper')) { | 221 | for (const wrapper of document.querySelectorAll( |
222 | '.services__webview-wrapper', | ||
223 | )) { | ||
216 | wrapper.style.display = ''; | 224 | wrapper.style.display = ''; |
217 | } | 225 | } |
218 | } | 226 | } |
@@ -262,7 +270,8 @@ export default class WorkspacesStore extends FeatureStore { | |||
262 | const activeService = this.stores.services.active; | 270 | const activeService = this.stores.services.active; |
263 | const workspaceServices = this.getWorkspaceServices(this.activeWorkspace); | 271 | const workspaceServices = this.getWorkspaceServices(this.activeWorkspace); |
264 | if (workspaceServices.length <= 0) return; | 272 | if (workspaceServices.length <= 0) return; |
265 | const isActiveServiceInWorkspace = workspaceServices.includes(activeService); | 273 | const isActiveServiceInWorkspace = |
274 | workspaceServices.includes(activeService); | ||
266 | if (!isActiveServiceInWorkspace) { | 275 | if (!isActiveServiceInWorkspace) { |
267 | this.actions.service.setActive({ | 276 | this.actions.service.setActive({ |
268 | serviceId: workspaceServices[0].id, | 277 | serviceId: workspaceServices[0].id, |
@@ -288,8 +297,10 @@ export default class WorkspacesStore extends FeatureStore { | |||
288 | const isWorkspaceSettingsRoute = router.location.pathname.includes( | 297 | const isWorkspaceSettingsRoute = router.location.pathname.includes( |
289 | WORKSPACES_ROUTES.ROOT, | 298 | WORKSPACES_ROUTES.ROOT, |
290 | ); | 299 | ); |
291 | const isSwitchingToSettingsRoute = !this.isSettingsRouteActive && isWorkspaceSettingsRoute; | 300 | const isSwitchingToSettingsRoute = |
292 | const isLeavingSettingsRoute = !isWorkspaceSettingsRoute && this.isSettingsRouteActive; | 301 | !this.isSettingsRouteActive && isWorkspaceSettingsRoute; |
302 | const isLeavingSettingsRoute = | ||
303 | !isWorkspaceSettingsRoute && this.isSettingsRouteActive; | ||
293 | 304 | ||
294 | if (isSwitchingToSettingsRoute) { | 305 | if (isSwitchingToSettingsRoute) { |
295 | this.isSettingsRouteActive = true; | 306 | this.isSettingsRouteActive = true; |
@@ -300,8 +311,8 @@ export default class WorkspacesStore extends FeatureStore { | |||
300 | } else if (isLeavingSettingsRoute) { | 311 | } else if (isLeavingSettingsRoute) { |
301 | this.isSettingsRouteActive = false; | 312 | this.isSettingsRouteActive = false; |
302 | if ( | 313 | if ( |
303 | !this._wasDrawerOpenBeforeSettingsRoute | 314 | !this._wasDrawerOpenBeforeSettingsRoute && |
304 | && this.isWorkspaceDrawerOpen | 315 | this.isWorkspaceDrawerOpen |
305 | ) { | 316 | ) { |
306 | workspaceActions.toggleWorkspaceDrawer(); | 317 | workspaceActions.toggleWorkspaceDrawer(); |
307 | } | 318 | } |
@@ -311,14 +322,15 @@ export default class WorkspacesStore extends FeatureStore { | |||
311 | _cleanupInvalidServiceReferences = () => { | 322 | _cleanupInvalidServiceReferences = () => { |
312 | const { services } = this.stores; | 323 | const { services } = this.stores; |
313 | const { allServicesRequest } = services; | 324 | const { allServicesRequest } = services; |
314 | const servicesHaveBeenLoaded = allServicesRequest.wasExecuted && !allServicesRequest.isError; | 325 | const servicesHaveBeenLoaded = |
326 | allServicesRequest.wasExecuted && !allServicesRequest.isError; | ||
315 | // Loop through all workspaces and remove invalid service ids (locally) | 327 | // Loop through all workspaces and remove invalid service ids (locally) |
316 | for (const workspace of this.workspaces) { | 328 | for (const workspace of this.workspaces) { |
317 | for (const serviceId of workspace.services) { | 329 | for (const serviceId of workspace.services) { |
318 | if ( | 330 | if ( |
319 | servicesHaveBeenLoaded | 331 | servicesHaveBeenLoaded && |
320 | && !services.one(serviceId) | 332 | !services.one(serviceId) && |
321 | && serviceId !== KEEP_WS_LOADED_USID | 333 | serviceId !== KEEP_WS_LOADED_USID |
322 | ) { | 334 | ) { |
323 | workspace.services.remove(serviceId); | 335 | workspace.services.remove(serviceId); |
324 | } | 336 | } |