From 14d2364fc69e0222133115c55a36286986006098 Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Fri, 15 Oct 2021 09:48:06 +0200 Subject: chore: update eslint setup (#2074) --- .../workspaces/components/WorkspaceDrawerItem.js | 8 ++-- .../workspaces/components/WorkspacesDashboard.js | 3 +- src/features/workspaces/store.js | 46 ++++++++++++++-------- 3 files changed, 34 insertions(+), 23 deletions(-) (limited to 'src/features/workspaces') 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 { isActive ? classes.isActiveItem : null, ])} onClick={onClick} - onContextMenu={() => - onContextMenuEditClick && contextMenu.popup() - } + onContextMenu={() => onContextMenuEditClick && contextMenu.popup()} data-tip={`${ shortcutIndex <= 9 ? `(${cmdOrCtrlShortcutKey(false)}+${altKey( - false, - )}+${shortcutIndex})` + false, + )}+${shortcutIndex})` : '' }`} > 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({ }, workspaceFeatureInfo: { id: 'settings.workspaces.workspaceFeatureInfo', - 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.', + 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.', }, workspaceFeatureHeadline: { 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 { this.isFeatureActive = false; } - filterServicesByActiveWorkspace = (services) => { + filterServicesByActiveWorkspace = services => { const { activeWorkspace, isFeatureActive } = this; if (isFeatureActive && activeWorkspace) { return this.getWorkspaceServices(activeWorkspace); @@ -134,14 +134,14 @@ export default class WorkspacesStore extends FeatureStore { getWorkspaceServices(workspace) { const { services } = this.stores; - return workspace.services.map((id) => services.one(id)).filter((s) => !!s); + return workspace.services.map(id => services.one(id)).filter(s => !!s); } // ========== PRIVATE METHODS ========= // - _getWorkspaceById = (id) => this.workspaces.find((w) => w.id === id); + _getWorkspaceById = id => this.workspaces.find(w => w.id === id); - _updateSettings = (changes) => { + _updateSettings = changes => { localStorage.setItem('workspaces', { ...this.settings, ...changes, @@ -191,9 +191,15 @@ export default class WorkspacesStore extends FeatureStore { this.isSwitchingWorkspace = false; this.nextWorkspace = null; if (this.stores.settings.app.splitMode) { - const serviceNames = new Set(this.getWorkspaceServices(workspace).map(service => service.name)); - for (const wrapper of document.querySelectorAll('.services__webview-wrapper')) { - wrapper.style.display = serviceNames.has(wrapper.dataset.name) ? '' : 'none'; + const serviceNames = new Set( + this.getWorkspaceServices(workspace).map(service => service.name), + ); + for (const wrapper of document.querySelectorAll( + '.services__webview-wrapper', + )) { + wrapper.style.display = serviceNames.has(wrapper.dataset.name) + ? '' + : 'none'; } } }, 1000); @@ -212,7 +218,9 @@ export default class WorkspacesStore extends FeatureStore { setTimeout(() => { this.isSwitchingWorkspace = false; if (this.stores.settings.app.splitMode) { - for (const wrapper of document.querySelectorAll('.services__webview-wrapper')) { + for (const wrapper of document.querySelectorAll( + '.services__webview-wrapper', + )) { wrapper.style.display = ''; } } @@ -262,7 +270,8 @@ export default class WorkspacesStore extends FeatureStore { const activeService = this.stores.services.active; const workspaceServices = this.getWorkspaceServices(this.activeWorkspace); if (workspaceServices.length <= 0) return; - const isActiveServiceInWorkspace = workspaceServices.includes(activeService); + const isActiveServiceInWorkspace = + workspaceServices.includes(activeService); if (!isActiveServiceInWorkspace) { this.actions.service.setActive({ serviceId: workspaceServices[0].id, @@ -288,8 +297,10 @@ export default class WorkspacesStore extends FeatureStore { const isWorkspaceSettingsRoute = router.location.pathname.includes( WORKSPACES_ROUTES.ROOT, ); - const isSwitchingToSettingsRoute = !this.isSettingsRouteActive && isWorkspaceSettingsRoute; - const isLeavingSettingsRoute = !isWorkspaceSettingsRoute && this.isSettingsRouteActive; + const isSwitchingToSettingsRoute = + !this.isSettingsRouteActive && isWorkspaceSettingsRoute; + const isLeavingSettingsRoute = + !isWorkspaceSettingsRoute && this.isSettingsRouteActive; if (isSwitchingToSettingsRoute) { this.isSettingsRouteActive = true; @@ -300,8 +311,8 @@ export default class WorkspacesStore extends FeatureStore { } else if (isLeavingSettingsRoute) { this.isSettingsRouteActive = false; if ( - !this._wasDrawerOpenBeforeSettingsRoute - && this.isWorkspaceDrawerOpen + !this._wasDrawerOpenBeforeSettingsRoute && + this.isWorkspaceDrawerOpen ) { workspaceActions.toggleWorkspaceDrawer(); } @@ -311,14 +322,15 @@ export default class WorkspacesStore extends FeatureStore { _cleanupInvalidServiceReferences = () => { const { services } = this.stores; const { allServicesRequest } = services; - const servicesHaveBeenLoaded = allServicesRequest.wasExecuted && !allServicesRequest.isError; + const servicesHaveBeenLoaded = + allServicesRequest.wasExecuted && !allServicesRequest.isError; // Loop through all workspaces and remove invalid service ids (locally) for (const workspace of this.workspaces) { for (const serviceId of workspace.services) { if ( - servicesHaveBeenLoaded - && !services.one(serviceId) - && serviceId !== KEEP_WS_LOADED_USID + servicesHaveBeenLoaded && + !services.one(serviceId) && + serviceId !== KEEP_WS_LOADED_USID ) { workspace.services.remove(serviceId); } -- cgit v1.2.3-54-g00ecf