diff options
author | André Oliveira <37463445+SpecialAro@users.noreply.github.com> | 2024-04-18 07:32:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-18 07:32:48 +0100 |
commit | 101a18cd41f53b62c77d16442db955855f1f2703 (patch) | |
tree | 3a0d0475647ad8c018126a8f127e8bf6c7774ce9 | |
parent | Remove pnpm cache (since its suspected that sqlite cache is corrupted) (#1703) (diff) | |
download | ferdium-app-101a18cd41f53b62c77d16442db955855f1f2703.tar.gz ferdium-app-101a18cd41f53b62c77d16442db955855f1f2703.tar.zst ferdium-app-101a18cd41f53b62c77d16442db955855f1f2703.zip |
feat: hide all services workspace (#1713)
* feat: hide all services workspace
* fix: change from 'show' to 'hide'
-rw-r--r-- | src/components/settings/settings/EditSettingsForm.tsx | 2 | ||||
-rw-r--r-- | src/config.ts | 1 | ||||
-rw-r--r-- | src/containers/layout/AppLayoutContainer.tsx | 2 | ||||
-rw-r--r-- | src/containers/settings/EditSettingsScreen.tsx | 16 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawer.tsx | 36 | ||||
-rw-r--r-- | src/i18n/locales/en-US.json | 1 | ||||
-rw-r--r-- | src/lib/Menu.ts | 28 |
7 files changed, 61 insertions, 25 deletions
diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 7e6a89f99..84057091d 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx | |||
@@ -838,6 +838,8 @@ class EditSettingsForm extends Component<IProps, IState> { | |||
838 | <Toggle {...form.$('hideDownloadButton').bind()} /> | 838 | <Toggle {...form.$('hideDownloadButton').bind()} /> |
839 | 839 | ||
840 | <Toggle {...form.$('alwaysShowWorkspaces').bind()} /> | 840 | <Toggle {...form.$('alwaysShowWorkspaces').bind()} /> |
841 | |||
842 | <Toggle {...form.$('hideAllServicesWorkspace').bind()} /> | ||
841 | </div> | 843 | </div> |
842 | )} | 844 | )} |
843 | 845 | ||
diff --git a/src/config.ts b/src/config.ts index 5b9a5eaba..f086c54ee 100644 --- a/src/config.ts +++ b/src/config.ts | |||
@@ -422,6 +422,7 @@ export const DEFAULT_APP_SETTINGS = { | |||
422 | hideSettingsButton: false, | 422 | hideSettingsButton: false, |
423 | hideDownloadButton: false, | 423 | hideDownloadButton: false, |
424 | alwaysShowWorkspaces: false, | 424 | alwaysShowWorkspaces: false, |
425 | hideAllServicesWorkspace: false, | ||
425 | liftSingleInstanceLock: false, | 426 | liftSingleInstanceLock: false, |
426 | enableLongPressServiceHint: false, | 427 | enableLongPressServiceHint: false, |
427 | isTodosFeatureEnabled: true, | 428 | isTodosFeatureEnabled: true, |
diff --git a/src/containers/layout/AppLayoutContainer.tsx b/src/containers/layout/AppLayoutContainer.tsx index 3f8aad0ac..b18aa4690 100644 --- a/src/containers/layout/AppLayoutContainer.tsx +++ b/src/containers/layout/AppLayoutContainer.tsx | |||
@@ -80,6 +80,8 @@ class AppLayoutContainer extends Component<IProps> { | |||
80 | ? workspaceStore.getWorkspaceServices(workspace).map(s => s.name) | 80 | ? workspaceStore.getWorkspaceServices(workspace).map(s => s.name) |
81 | : services.all.map(s => s.name) | 81 | : services.all.map(s => s.name) |
82 | } | 82 | } |
83 | stores={this.props.stores} | ||
84 | actions={this.props.actions} | ||
83 | /> | 85 | /> |
84 | ); | 86 | ); |
85 | 87 | ||
diff --git a/src/containers/settings/EditSettingsScreen.tsx b/src/containers/settings/EditSettingsScreen.tsx index b731ad50a..fdd9bd8bc 100644 --- a/src/containers/settings/EditSettingsScreen.tsx +++ b/src/containers/settings/EditSettingsScreen.tsx | |||
@@ -277,6 +277,10 @@ const messages = defineMessages({ | |||
277 | id: 'settings.app.form.alwaysShowWorkspaces', | 277 | id: 'settings.app.form.alwaysShowWorkspaces', |
278 | defaultMessage: 'Always show workspace drawer', | 278 | defaultMessage: 'Always show workspace drawer', |
279 | }, | 279 | }, |
280 | hideAllServicesWorkspace: { | ||
281 | id: 'settings.app.form.hideAllServicesWorkspace', | ||
282 | defaultMessage: 'Hide "All services" workspace', | ||
283 | }, | ||
280 | accentColor: { | 284 | accentColor: { |
281 | id: 'settings.app.form.accentColor', | 285 | id: 'settings.app.form.accentColor', |
282 | defaultMessage: 'Accent color', | 286 | defaultMessage: 'Accent color', |
@@ -453,6 +457,9 @@ class EditSettingsScreen extends Component< | |||
453 | hideSettingsButton: Boolean(settingsData.hideSettingsButton), | 457 | hideSettingsButton: Boolean(settingsData.hideSettingsButton), |
454 | hideDownloadButton: Boolean(settingsData.hideDownloadButton), | 458 | hideDownloadButton: Boolean(settingsData.hideDownloadButton), |
455 | alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces), | 459 | alwaysShowWorkspaces: Boolean(settingsData.alwaysShowWorkspaces), |
460 | hideAllServicesWorkspace: Boolean( | ||
461 | settingsData.hideAllServicesWorkspace, | ||
462 | ), | ||
456 | accentColor: settingsData.accentColor, | 463 | accentColor: settingsData.accentColor, |
457 | progressbarAccentColor: settingsData.progressbarAccentColor, | 464 | progressbarAccentColor: settingsData.progressbarAccentColor, |
458 | showMessageBadgeWhenMuted: Boolean( | 465 | showMessageBadgeWhenMuted: Boolean( |
@@ -1155,6 +1162,15 @@ class EditSettingsScreen extends Component< | |||
1155 | default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, | 1162 | default: DEFAULT_APP_SETTINGS.alwaysShowWorkspaces, |
1156 | type: 'checkbox', | 1163 | type: 'checkbox', |
1157 | }, | 1164 | }, |
1165 | hideAllServicesWorkspace: { | ||
1166 | label: intl.formatMessage(messages.hideAllServicesWorkspace), | ||
1167 | value: ifUndefined<boolean>( | ||
1168 | settings.all.app.hideAllServicesWorkspace, | ||
1169 | DEFAULT_APP_SETTINGS.hideAllServicesWorkspace, | ||
1170 | ), | ||
1171 | default: DEFAULT_APP_SETTINGS.hideAllServicesWorkspace, | ||
1172 | type: 'checkbox', | ||
1173 | }, | ||
1158 | accentColor: { | 1174 | accentColor: { |
1159 | label: intl.formatMessage(messages.accentColor), | 1175 | label: intl.formatMessage(messages.accentColor), |
1160 | value: ifUndefined<string>( | 1176 | value: ifUndefined<string>( |
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 @@ | |||
1 | import { mdiCog, mdiPlusBox } from '@mdi/js'; | 1 | import { mdiCog, mdiPlusBox } from '@mdi/js'; |
2 | import { noop } from 'lodash'; | 2 | import { noop } from 'lodash'; |
3 | import { observer } from 'mobx-react'; | 3 | import { inject, observer } from 'mobx-react'; |
4 | import { Component, type ReactElement } from 'react'; | 4 | import { Component, type ReactElement } from 'react'; |
5 | import { | 5 | import { |
6 | type WrappedComponentProps, | 6 | type WrappedComponentProps, |
@@ -9,6 +9,7 @@ import { | |||
9 | } from 'react-intl'; | 9 | } from 'react-intl'; |
10 | import withStyles, { type WithStylesProps } from 'react-jss'; | 10 | import withStyles, { type WithStylesProps } from 'react-jss'; |
11 | import { Tooltip as ReactTooltip } from 'react-tooltip'; | 11 | import { Tooltip as ReactTooltip } from 'react-tooltip'; |
12 | import type { StoresProps } from 'src/@types/ferdium-components.types'; | ||
12 | import { H1 } from '../../../components/ui/headline'; | 13 | import { H1 } from '../../../components/ui/headline'; |
13 | import Icon from '../../../components/ui/icon'; | 14 | import Icon from '../../../components/ui/icon'; |
14 | import workspaceActions from '../actions'; | 15 | import workspaceActions from '../actions'; |
@@ -92,10 +93,14 @@ const styles = theme => ({ | |||
92 | }, | 93 | }, |
93 | }); | 94 | }); |
94 | 95 | ||
95 | interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps { | 96 | interface IProps |
97 | extends WithStylesProps<typeof styles>, | ||
98 | WrappedComponentProps, | ||
99 | StoresProps { | ||
96 | getServicesForWorkspace: (workspace: Workspace | null) => string[]; | 100 | getServicesForWorkspace: (workspace: Workspace | null) => string[]; |
97 | } | 101 | } |
98 | 102 | ||
103 | @inject('stores') | ||
99 | @observer | 104 | @observer |
100 | class WorkspaceDrawer extends Component<IProps> { | 105 | class WorkspaceDrawer extends Component<IProps> { |
101 | componentDidMount(): void { | 106 | componentDidMount(): void { |
@@ -115,6 +120,11 @@ class WorkspaceDrawer extends Component<IProps> { | |||
115 | const actualWorkspace = isSwitchingWorkspace | 120 | const actualWorkspace = isSwitchingWorkspace |
116 | ? nextWorkspace | 121 | ? nextWorkspace |
117 | : activeWorkspace; | 122 | : activeWorkspace; |
123 | |||
124 | const { settings } = this.props.stores; | ||
125 | |||
126 | const { hideAllServicesWorkspace } = settings.all.app; | ||
127 | |||
118 | return ( | 128 | return ( |
119 | <div className={`${classes.drawer} workspaces-drawer`}> | 129 | <div className={`${classes.drawer} workspaces-drawer`}> |
120 | <H1 className={classes.headline}> | 130 | <H1 className={classes.headline}> |
@@ -138,16 +148,18 @@ class WorkspaceDrawer extends Component<IProps> { | |||
138 | </span> | 148 | </span> |
139 | </H1> | 149 | </H1> |
140 | <div className={classes.workspaces}> | 150 | <div className={classes.workspaces}> |
141 | <WorkspaceDrawerItem | 151 | {!hideAllServicesWorkspace && ( |
142 | name={intl.formatMessage(messages.allServices)} | 152 | <WorkspaceDrawerItem |
143 | onClick={() => { | 153 | name={intl.formatMessage(messages.allServices)} |
144 | workspaceActions.deactivate(); | 154 | onClick={() => { |
145 | workspaceActions.toggleWorkspaceDrawer(); | 155 | workspaceActions.deactivate(); |
146 | }} | 156 | workspaceActions.toggleWorkspaceDrawer(); |
147 | services={getServicesForWorkspace(null)} | 157 | }} |
148 | isActive={actualWorkspace == null} | 158 | services={getServicesForWorkspace(null)} |
149 | shortcutIndex={0} | 159 | isActive={actualWorkspace == null} |
150 | /> | 160 | shortcutIndex={0} |
161 | /> | ||
162 | )} | ||
151 | {workspaces.map((workspace, index) => ( | 163 | {workspaces.map((workspace, index) => ( |
152 | <WorkspaceDrawerItem | 164 | <WorkspaceDrawerItem |
153 | key={workspace.id} | 165 | key={workspace.id} |
diff --git a/src/i18n/locales/en-US.json b/src/i18n/locales/en-US.json index 1f7eff3e9..622f758c3 100644 --- a/src/i18n/locales/en-US.json +++ b/src/i18n/locales/en-US.json | |||
@@ -222,6 +222,7 @@ | |||
222 | "settings.app.form.grayscaleServicesDim": "Grayscale dim level", | 222 | "settings.app.form.grayscaleServicesDim": "Grayscale dim level", |
223 | "settings.app.form.hibernateOnStartup": "Keep services in hibernation on startup", | 223 | "settings.app.form.hibernateOnStartup": "Keep services in hibernation on startup", |
224 | "settings.app.form.hibernationStrategy": "Hibernation strategy", | 224 | "settings.app.form.hibernationStrategy": "Hibernation strategy", |
225 | "settings.app.form.hideAllServicesWorkspace": "Hide \"All services\" workspace", | ||
225 | "settings.app.form.hideCollapseButton": "Hide Collapse button", | 226 | "settings.app.form.hideCollapseButton": "Hide Collapse button", |
226 | "settings.app.form.hideDownloadButton": "Hide Downloads button", | 227 | "settings.app.form.hideDownloadButton": "Hide Downloads button", |
227 | "settings.app.form.hideNotificationsButton": "Hide Notifications & Sound button", | 228 | "settings.app.form.hideNotificationsButton": "Hide Notifications & Sound button", |
diff --git a/src/lib/Menu.ts b/src/lib/Menu.ts index f7ed3b310..d72bf53e5 100644 --- a/src/lib/Menu.ts +++ b/src/lib/Menu.ts | |||
@@ -1186,20 +1186,22 @@ class FranzMenu implements StoresProps { | |||
1186 | }); | 1186 | }); |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | menu.push( | 1189 | if (!this.stores.settings.app.hideAllServicesWorkspace) { |
1190 | { | 1190 | menu.push( |
1191 | type: 'separator', | 1191 | { |
1192 | }, | 1192 | type: 'separator', |
1193 | { | ||
1194 | label: intl.formatMessage(menuItems.defaultWorkspace), | ||
1195 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+0`, | ||
1196 | type: 'radio', | ||
1197 | checked: !activeWorkspace, | ||
1198 | click: () => { | ||
1199 | workspaceActions.deactivate(); | ||
1200 | }, | 1193 | }, |
1201 | }, | 1194 | { |
1202 | ); | 1195 | label: intl.formatMessage(menuItems.defaultWorkspace), |
1196 | accelerator: `${cmdOrCtrlShortcutKey()}+${altKey()}+0`, | ||
1197 | type: 'radio', | ||
1198 | checked: !activeWorkspace, | ||
1199 | click: () => { | ||
1200 | workspaceActions.deactivate(); | ||
1201 | }, | ||
1202 | }, | ||
1203 | ); | ||
1204 | } | ||
1203 | 1205 | ||
1204 | // Workspace items | 1206 | // Workspace items |
1205 | for (const [i, workspace] of workspaces.entries()) { | 1207 | for (const [i, workspace] of workspaces.entries()) { |