From 101a18cd41f53b62c77d16442db955855f1f2703 Mon Sep 17 00:00:00 2001
From: André Oliveira <37463445+SpecialAro@users.noreply.github.com>
Date: Thu, 18 Apr 2024 07:32:48 +0100
Subject: feat: hide all services workspace (#1713)

* feat: hide all services workspace

* fix: change from 'show' to 'hide'
---
 .../workspaces/components/WorkspaceDrawer.tsx      | 36 ++++++++++++++--------
 1 file changed, 24 insertions(+), 12 deletions(-)

(limited to 'src/features/workspaces/components/WorkspaceDrawer.tsx')

diff --git a/src/features/workspaces/components/WorkspaceDrawer.tsx b/src/features/workspaces/components/WorkspaceDrawer.tsx
index 2826b741a..cce333b31 100644
--- a/src/features/workspaces/components/WorkspaceDrawer.tsx
+++ b/src/features/workspaces/components/WorkspaceDrawer.tsx
@@ -1,6 +1,6 @@
 import { mdiCog, mdiPlusBox } from '@mdi/js';
 import { noop } from 'lodash';
-import { observer } from 'mobx-react';
+import { inject, observer } from 'mobx-react';
 import { Component, type ReactElement } from 'react';
 import {
   type WrappedComponentProps,
@@ -9,6 +9,7 @@ import {
 } from 'react-intl';
 import withStyles, { type WithStylesProps } from 'react-jss';
 import { Tooltip as ReactTooltip } from 'react-tooltip';
+import type { StoresProps } from 'src/@types/ferdium-components.types';
 import { H1 } from '../../../components/ui/headline';
 import Icon from '../../../components/ui/icon';
 import workspaceActions from '../actions';
@@ -92,10 +93,14 @@ const styles = theme => ({
   },
 });
 
-interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps {
+interface IProps
+  extends WithStylesProps<typeof styles>,
+    WrappedComponentProps,
+    StoresProps {
   getServicesForWorkspace: (workspace: Workspace | null) => string[];
 }
 
+@inject('stores')
 @observer
 class WorkspaceDrawer extends Component<IProps> {
   componentDidMount(): void {
@@ -115,6 +120,11 @@ class WorkspaceDrawer extends Component<IProps> {
     const actualWorkspace = isSwitchingWorkspace
       ? nextWorkspace
       : activeWorkspace;
+
+    const { settings } = this.props.stores;
+
+    const { hideAllServicesWorkspace } = settings.all.app;
+
     return (
       <div className={`${classes.drawer} workspaces-drawer`}>
         <H1 className={classes.headline}>
@@ -138,16 +148,18 @@ class WorkspaceDrawer extends Component<IProps> {
           </span>
         </H1>
         <div className={classes.workspaces}>
-          <WorkspaceDrawerItem
-            name={intl.formatMessage(messages.allServices)}
-            onClick={() => {
-              workspaceActions.deactivate();
-              workspaceActions.toggleWorkspaceDrawer();
-            }}
-            services={getServicesForWorkspace(null)}
-            isActive={actualWorkspace == null}
-            shortcutIndex={0}
-          />
+          {!hideAllServicesWorkspace && (
+            <WorkspaceDrawerItem
+              name={intl.formatMessage(messages.allServices)}
+              onClick={() => {
+                workspaceActions.deactivate();
+                workspaceActions.toggleWorkspaceDrawer();
+              }}
+              services={getServicesForWorkspace(null)}
+              isActive={actualWorkspace == null}
+              shortcutIndex={0}
+            />
+          )}
           {workspaces.map((workspace, index) => (
             <WorkspaceDrawerItem
               key={workspace.id}
-- 
cgit v1.2.3-70-g09d2

