@openmrs/esm-styleguide 8.0.1-pre.3717 → 8.0.1-pre.3727
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +1 -1
- package/dist/dashboard-extension/index.d.ts.map +1 -1
- package/dist/openmrs-esm-styleguide.css +1 -1
- package/dist/openmrs-esm-styleguide.css.map +1 -1
- package/dist/openmrs-esm-styleguide.js +1 -1
- package/dist/openmrs-esm-styleguide.js.map +1 -1
- package/dist/workspaces2/action-menu2/action-menu2.component.d.ts +1 -1
- package/dist/workspaces2/action-menu2/action-menu2.component.d.ts.map +1 -1
- package/dist/workspaces2/active-workspace-window.component.d.ts +1 -0
- package/dist/workspaces2/active-workspace-window.component.d.ts.map +1 -1
- package/dist/workspaces2/workspace2.component.d.ts +1 -0
- package/dist/workspaces2/workspace2.component.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/dashboard-extension/dashboard.test.tsx +70 -0
- package/src/dashboard-extension/index.tsx +6 -6
- package/src/workspaces2/action-menu2/action-menu2.component.tsx +1 -9
- package/src/workspaces2/active-workspace-window.component.tsx +7 -1
- package/src/workspaces2/workspace-windows-and-menu.component.tsx +15 -3
- package/src/workspaces2/workspace2.component.tsx +3 -1
- package/src/workspaces2/workspace2.module.scss +3 -1
|
@@ -12,6 +12,6 @@ export interface ActionMenuProps {
|
|
|
12
12
|
* for a workspace group. The action menu is only rendered when at least one
|
|
13
13
|
* window in the workspace group has an icon defined.
|
|
14
14
|
*/
|
|
15
|
-
export declare function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps): React.JSX.Element
|
|
15
|
+
export declare function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps): React.JSX.Element;
|
|
16
16
|
export default ActionMenu;
|
|
17
17
|
//# sourceMappingURL=action-menu2.component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-menu2.component.d.ts","sourceRoot":"","sources":["../../../src/workspaces2/action-menu2/action-menu2.component.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,yBAAyB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"action-menu2.component.d.ts","sourceRoot":"","sources":["../../../src/workspaces2/action-menu2/action-menu2.component.tsx"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,KAAK,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAOtE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,yBAAyB,GAAG;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACnE,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,EAAE,eAAe,qBA8BzE;AAED,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAAyC,MAAM,yBAAyB,CAAC;AAOnG,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"active-workspace-window.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/active-workspace-window.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAK5D,OAAO,EAAE,KAAK,YAAY,EAAyC,MAAM,yBAAyB,CAAC;AAOnG,UAAU,oBAAoB;IAC5B,YAAY,EAAE,YAAY,CAAC;IAC3B,cAAc,EAAE,OAAO,CAAC;CACzB;AACD;;GAEG;AACH,QAAA,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA6BzD,CAAC;AA6GF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CACxC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAEhG;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvG,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace2.component.d.ts","sourceRoot":"","sources":["../../src/workspaces2/workspace2.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAWzD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CACxC,cAAc,SAAS,MAAM,GAAG,MAAM,EACtC,WAAW,SAAS,MAAM,GAAG,MAAM,EACnC,UAAU,SAAS,MAAM,GAAG,MAAM;IAElC;;;;;;OAMG;IACH,oBAAoB,CAAC,KAAK,SAAS,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAEhG;;;;;OAKG;IACH,cAAc,CAAC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,OAAO,CAAC;QAAC,qBAAqB,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEvG,cAAc,EAAE,cAAc,GAAG,IAAI,CAAC;IACtC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;IAChC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,CAC9B,cAAc,SAAS,MAAM,EAC7B,WAAW,SAAS,MAAM,EAC1B,UAAU,SAAS,MAAM,IACvB,KAAK,CAAC,EAAE,CAAC,yBAAyB,CAAC,cAAc,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC,CAAC;AAEjF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2JhD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openmrs/esm-styleguide",
|
|
3
|
-
"version": "8.0.1-pre.
|
|
3
|
+
"version": "8.0.1-pre.3727",
|
|
4
4
|
"license": "MPL-2.0",
|
|
5
5
|
"description": "The styleguide for OpenMRS SPA",
|
|
6
6
|
"main": "dist/openmrs-esm-styleguide.js",
|
|
@@ -98,17 +98,17 @@
|
|
|
98
98
|
"swr": "2.x"
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
|
-
"@openmrs/esm-api": "8.0.1-pre.
|
|
102
|
-
"@openmrs/esm-config": "8.0.1-pre.
|
|
103
|
-
"@openmrs/esm-emr-api": "8.0.1-pre.
|
|
104
|
-
"@openmrs/esm-error-handling": "8.0.1-pre.
|
|
105
|
-
"@openmrs/esm-extensions": "8.0.1-pre.
|
|
106
|
-
"@openmrs/esm-globals": "8.0.1-pre.
|
|
107
|
-
"@openmrs/esm-navigation": "8.0.1-pre.
|
|
108
|
-
"@openmrs/esm-react-utils": "8.0.1-pre.
|
|
109
|
-
"@openmrs/esm-state": "8.0.1-pre.
|
|
110
|
-
"@openmrs/esm-translations": "8.0.1-pre.
|
|
111
|
-
"@openmrs/esm-utils": "8.0.1-pre.
|
|
101
|
+
"@openmrs/esm-api": "8.0.1-pre.3727",
|
|
102
|
+
"@openmrs/esm-config": "8.0.1-pre.3727",
|
|
103
|
+
"@openmrs/esm-emr-api": "8.0.1-pre.3727",
|
|
104
|
+
"@openmrs/esm-error-handling": "8.0.1-pre.3727",
|
|
105
|
+
"@openmrs/esm-extensions": "8.0.1-pre.3727",
|
|
106
|
+
"@openmrs/esm-globals": "8.0.1-pre.3727",
|
|
107
|
+
"@openmrs/esm-navigation": "8.0.1-pre.3727",
|
|
108
|
+
"@openmrs/esm-react-utils": "8.0.1-pre.3727",
|
|
109
|
+
"@openmrs/esm-state": "8.0.1-pre.3727",
|
|
110
|
+
"@openmrs/esm-translations": "8.0.1-pre.3727",
|
|
111
|
+
"@openmrs/esm-utils": "8.0.1-pre.3727",
|
|
112
112
|
"@rspack/cli": "^1.3.11",
|
|
113
113
|
"@rspack/core": "^1.3.11",
|
|
114
114
|
"@types/geopattern": "^1.2.9",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import '@testing-library/jest-dom/vitest';
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
import { MemoryRouter } from 'react-router-dom';
|
|
6
|
+
import { DashboardExtension } from './index';
|
|
7
|
+
|
|
8
|
+
describe('DashboardExtension', () => {
|
|
9
|
+
describe('Basic Rendering', () => {
|
|
10
|
+
it('renders with required props (path and title)', () => {
|
|
11
|
+
renderDashboardExtension('/base', 'dashboard', 'Dashboard', '/base');
|
|
12
|
+
expect(screen.getByText('Dashboard')).toBeInTheDocument();
|
|
13
|
+
const link = screen.getByRole('link');
|
|
14
|
+
expect(link).toBeInTheDocument();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('renders ConfigurableLink with correct href', () => {
|
|
18
|
+
renderDashboardExtension('/base', 'dashboard', 'Dashboard', '/base');
|
|
19
|
+
|
|
20
|
+
const link = screen.getByRole('link');
|
|
21
|
+
expect(link).toHaveAttribute('href', '/base/dashboard');
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('Active State Logic', () => {
|
|
26
|
+
it('is active when current pathname matches dashboard path', () => {
|
|
27
|
+
renderDashboardExtension('/base/dashboard', 'dashboard', 'Dashboard', '/base');
|
|
28
|
+
|
|
29
|
+
const link = screen.getByRole('link');
|
|
30
|
+
expect(link).toHaveClass('active-left-nav-link');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('is active when path segments match (partial match)', () => {
|
|
34
|
+
renderDashboardExtension('/base/dashboard/patients', 'patients', 'Dashboard', '/base');
|
|
35
|
+
|
|
36
|
+
const link = screen.getByRole('link');
|
|
37
|
+
expect(link).toHaveClass('active-left-nav-link');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('is not active when path does not match', () => {
|
|
41
|
+
renderDashboardExtension('/base/other', 'dashboard', 'Dashboard', '/base');
|
|
42
|
+
|
|
43
|
+
const link = screen.getByRole('link');
|
|
44
|
+
expect(link).not.toHaveClass('active-left-nav-link');
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('handles empty path (returns false)', () => {
|
|
48
|
+
renderDashboardExtension('/base', '', 'Dashboard', '/base');
|
|
49
|
+
|
|
50
|
+
const link = screen.getByRole('link');
|
|
51
|
+
expect(link).not.toHaveClass('active-left-nav-link');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('handles path with encoded characters in location', () => {
|
|
55
|
+
renderDashboardExtension('/base/dashboard%20%26%20test', 'dashboard & test', 'Dashboard', '/base');
|
|
56
|
+
|
|
57
|
+
const link = screen.getByRole('link');
|
|
58
|
+
expect(link).toHaveClass('active-left-nav-link');
|
|
59
|
+
expect(link).toHaveAttribute('href', '/base/dashboard%20%26%20test');
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const renderDashboardExtension = (browserPath: string, path: string, title: string, basePath: string) => {
|
|
65
|
+
render(
|
|
66
|
+
<MemoryRouter initialEntries={[browserPath]}>
|
|
67
|
+
<DashboardExtension path={path} title={title} basePath={basePath} />
|
|
68
|
+
</MemoryRouter>,
|
|
69
|
+
);
|
|
70
|
+
};
|
|
@@ -2,7 +2,6 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { useTranslation } from 'react-i18next';
|
|
4
4
|
import { BrowserRouter, useLocation } from 'react-router-dom';
|
|
5
|
-
import { shallowEqual } from '@openmrs/esm-utils';
|
|
6
5
|
import { ConfigurableLink, MaybeIcon } from '@openmrs/esm-framework';
|
|
7
6
|
import { type IconId } from '../icons';
|
|
8
7
|
import styles from './dashboard.module.scss';
|
|
@@ -26,13 +25,14 @@ export const DashboardExtension = ({ path, title, basePath, icon }: DashboardExt
|
|
|
26
25
|
if (p.startsWith('http')) {
|
|
27
26
|
return p === window.location.href;
|
|
28
27
|
}
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
const localPath = (location.pathname ?? '')
|
|
28
|
+
const pathSegments = p.split('/').map((s) => decodeURIComponent(s));
|
|
29
|
+
const localSegments = (location.pathname ?? '')
|
|
32
30
|
.split('/')
|
|
33
|
-
.slice(
|
|
31
|
+
.slice(1)
|
|
34
32
|
.map((s) => decodeURIComponent(s));
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
// Check if pathSegments appear as a contiguous slice anywhere in localSegments
|
|
35
|
+
return localSegments.some((_, i) => pathSegments.every((seg, j) => localSegments[i + j] === seg));
|
|
36
36
|
}, [location.pathname, path]);
|
|
37
37
|
|
|
38
38
|
return (
|
|
@@ -23,17 +23,9 @@ export interface ActionMenuProps {
|
|
|
23
23
|
* window in the workspace group has an icon defined.
|
|
24
24
|
*/
|
|
25
25
|
export function ActionMenu({ workspaceGroup, groupProps }: ActionMenuProps) {
|
|
26
|
-
const { registeredWindowsByName } = useWorkspace2Store();
|
|
27
26
|
const layout = useLayoutType();
|
|
28
|
-
const { name:
|
|
27
|
+
const { name: persistence } = workspaceGroup;
|
|
29
28
|
|
|
30
|
-
const windowsWithIcons = Object.values(registeredWindowsByName)
|
|
31
|
-
.filter((window): window is Required<typeof window> => window.group === groupName && window.icon !== undefined)
|
|
32
|
-
.sort((a, b) => (a.order ?? Number.MAX_VALUE) - (b.order ?? Number.MAX_VALUE));
|
|
33
|
-
|
|
34
|
-
if (windowsWithIcons.length === 0) {
|
|
35
|
-
return null; // No icons to display
|
|
36
|
-
}
|
|
37
29
|
const isClosable = persistence == 'closable';
|
|
38
30
|
|
|
39
31
|
return (
|
|
@@ -12,11 +12,12 @@ import styles from './workspace2.module.scss';
|
|
|
12
12
|
|
|
13
13
|
interface WorkspaceWindowProps {
|
|
14
14
|
openedWindow: OpenedWindow;
|
|
15
|
+
showActionMenu: boolean;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Renders an opened workspace window.
|
|
18
19
|
*/
|
|
19
|
-
const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow }) => {
|
|
20
|
+
const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow, showActionMenu }) => {
|
|
20
21
|
const { openedWorkspaces } = openedWindow;
|
|
21
22
|
const [lifeCycles, setLifeCycles] = useState<ParcelConfig[]>();
|
|
22
23
|
const { registeredWorkspacesByName } = workspace2Store.getState();
|
|
@@ -40,6 +41,7 @@ const ActiveWorkspaceWindow: React.FC<WorkspaceWindowProps> = ({ openedWindow })
|
|
|
40
41
|
lifeCycle={lifeCycles && lifeCycles[i] ? lifeCycles[i] : undefined}
|
|
41
42
|
isRootWorkspace={i === 0}
|
|
42
43
|
isLeafWorkspace={i === openedWorkspaces.length - 1}
|
|
44
|
+
showActionMenu={showActionMenu}
|
|
43
45
|
/>
|
|
44
46
|
))}
|
|
45
47
|
</>
|
|
@@ -52,6 +54,7 @@ interface ActiveWorkspaceProps {
|
|
|
52
54
|
openedWindow: OpenedWindow;
|
|
53
55
|
isRootWorkspace: boolean;
|
|
54
56
|
isLeafWorkspace: boolean;
|
|
57
|
+
showActionMenu: boolean;
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
@@ -60,6 +63,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
|
60
63
|
openedWindow,
|
|
61
64
|
isRootWorkspace,
|
|
62
65
|
isLeafWorkspace,
|
|
66
|
+
showActionMenu,
|
|
63
67
|
}) => {
|
|
64
68
|
const { openedGroup, closeWorkspace, openChildWorkspace } = useWorkspace2Store();
|
|
65
69
|
|
|
@@ -108,6 +112,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
|
108
112
|
isRootWorkspace,
|
|
109
113
|
isLeafWorkspace,
|
|
110
114
|
windowName: openedWindow.windowName,
|
|
115
|
+
showActionMenu,
|
|
111
116
|
},
|
|
112
117
|
[openedWorkspace, closeWorkspace, openedGroup, openedWindow],
|
|
113
118
|
);
|
|
@@ -132,6 +137,7 @@ const ActiveWorkspace: React.FC<ActiveWorkspaceProps> = ({
|
|
|
132
137
|
<div
|
|
133
138
|
className={classNames(styles.workspaceMiddleContainer, {
|
|
134
139
|
[styles.isRootWorkspace]: isRootWorkspace,
|
|
140
|
+
[styles.showActionMenu]: showActionMenu,
|
|
135
141
|
})}
|
|
136
142
|
>
|
|
137
143
|
<div
|
|
@@ -19,7 +19,7 @@ export function renderWorkspaceWindowsAndMenu(target: HTMLElement | null) {
|
|
|
19
19
|
* and all the active workspace windows within that group.
|
|
20
20
|
*/
|
|
21
21
|
function WorkspaceWindowsAndMenu() {
|
|
22
|
-
const { openedGroup, openedWindows, registeredGroupsByName } = useWorkspace2Store();
|
|
22
|
+
const { openedGroup, openedWindows, registeredGroupsByName, registeredWindowsByName } = useWorkspace2Store();
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
const unsubscribe = subscribeOpenmrsEvent('before-page-changed', (pageChangedEvent) => {
|
|
@@ -41,6 +41,12 @@ function WorkspaceWindowsAndMenu() {
|
|
|
41
41
|
const group = registeredGroupsByName[openedGroup.groupName];
|
|
42
42
|
const hasMaximizedWindow = openedWindows.some((window) => window.maximized);
|
|
43
43
|
|
|
44
|
+
const { name: groupName } = group;
|
|
45
|
+
const windowsWithIcons = Object.values(registeredWindowsByName)
|
|
46
|
+
.filter((window): window is Required<typeof window> => window.group === groupName && window.icon !== undefined)
|
|
47
|
+
.sort((a, b) => (a.order ?? Number.MAX_VALUE) - (b.order ?? Number.MAX_VALUE));
|
|
48
|
+
const showActionMenu = windowsWithIcons.length > 0;
|
|
49
|
+
|
|
44
50
|
return (
|
|
45
51
|
<div
|
|
46
52
|
className={classNames(styles.workspaceWindowsAndMenuContainer, {
|
|
@@ -50,10 +56,16 @@ function WorkspaceWindowsAndMenu() {
|
|
|
50
56
|
>
|
|
51
57
|
<div className={styles.workspaceWindowsContainer}>
|
|
52
58
|
{openedWindows.map((openedWindow) => {
|
|
53
|
-
return
|
|
59
|
+
return (
|
|
60
|
+
<ActiveWorkspaceWindow
|
|
61
|
+
key={openedWindow.windowName}
|
|
62
|
+
openedWindow={openedWindow}
|
|
63
|
+
showActionMenu={showActionMenu}
|
|
64
|
+
/>
|
|
65
|
+
);
|
|
54
66
|
})}
|
|
55
67
|
</div>
|
|
56
|
-
<ActionMenu workspaceGroup={group} groupProps={openedGroup.props} />
|
|
68
|
+
{showActionMenu && <ActionMenu workspaceGroup={group} groupProps={openedGroup.props} />}
|
|
57
69
|
</div>
|
|
58
70
|
);
|
|
59
71
|
}
|
|
@@ -46,6 +46,7 @@ export interface Workspace2DefinitionProps<
|
|
|
46
46
|
workspaceName: string;
|
|
47
47
|
windowName: string;
|
|
48
48
|
isRootWorkspace: boolean;
|
|
49
|
+
showActionMenu: boolean;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
/**
|
|
@@ -79,7 +80,7 @@ export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsa
|
|
|
79
80
|
setWorkspaceTitle,
|
|
80
81
|
isMostRecentlyOpenedWindowHidden,
|
|
81
82
|
} = useWorkspace2Store();
|
|
82
|
-
const { workspaceName, isRootWorkspace, closeWorkspace } = useWorkspace2Context();
|
|
83
|
+
const { workspaceName, isRootWorkspace, closeWorkspace, showActionMenu } = useWorkspace2Context();
|
|
83
84
|
|
|
84
85
|
const openedWindowIndex = getOpenedWindowIndexByWorkspace(workspaceName);
|
|
85
86
|
|
|
@@ -145,6 +146,7 @@ export const Workspace2: React.FC<Workspace2Props> = ({ title, children, hasUnsa
|
|
|
145
146
|
[styles.maximized]: maximized,
|
|
146
147
|
[styles.hidden]: isWindowHidden,
|
|
147
148
|
[styles.isRootWorkspace]: isRootWorkspace,
|
|
149
|
+
[styles.showActionMenu]: showActionMenu,
|
|
148
150
|
})}
|
|
149
151
|
>
|
|
150
152
|
<div
|
|
@@ -187,7 +187,9 @@ $extraWideWorkspaceWidth: 48.25rem;
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// in tablet mode, reduce the height to of the workspace window to accommodate the workspace menu (bottom nav)
|
|
190
|
-
|
|
190
|
+
&.showActionMenu {
|
|
191
|
+
height: calc(100% - layout.$spacing-10);
|
|
192
|
+
}
|
|
191
193
|
}
|
|
192
194
|
|
|
193
195
|
.workspaceInnerContainer {
|