diff --git a/extensions/default/src/getCommandsModule.js b/extensions/default/src/getCommandsModule.js
new file mode 100644
index 000000000..43cc760a4
--- /dev/null
+++ b/extensions/default/src/getCommandsModule.js
@@ -0,0 +1,65 @@
+// SEE:
+// https://github.com/OHIF/Viewers/blob/b58aa4575ab72fe3f493cc5a4261b4f8256516ab/platform/viewer/src/appExtensions/MeasurementsPanel/index.js#L18-L49
+import React from 'react';
+import { useViewportGrid } from '@ohif/ui';
+
+
+function getCommandsModule ({ servicesManager }) {
+ const { UIDialogService } = servicesManager.services;
+
+ const definitions = {
+ toggleLayoutSelectionDialog: {
+ commandFn: () => {
+ if (!UIDialogService) {
+ window.alert('Unable to show dialog; no UI Dialog Service available.');
+ return;
+ }
+
+ // TODO: use SimpleDialog component
+ // TODO: update position on window resize
+ // TODO: Expand service API to check if dialog w/ ID is already open
+ // TODO: Import and call `useViewportGrid`
+ UIDialogService.dismiss({ id: 'layoutSelection' });
+ UIDialogService.create({
+ id: 'layoutSelection',
+ centralize: true,
+ isDraggable: false,
+ showOverlay: true,
+ content: Test,
+ });
+
+ },
+ storeContexts: [],
+ options: {},
+ context: 'VIEWER',
+ },
+ }
+
+ return {
+ definitions,
+ defaultContext: 'VIEWER',
+ };
+}
+
+function Test() {
+ const [
+ { numCols, numRows, activeViewportIndex, viewports },
+ dispatch,
+ ] = useViewportGrid();
+
+ return
{
+ dispatch({ type: '', payload: {
+ numCols: 3,
+ numRows: 3,
+ activeViewportIndex: 0,
+ viewports: [],
+ }})
+ }}
+ style={{ color: 'white' }}
+ >
+ Hello World!
+
+}
+
+export default getCommandsModule;
diff --git a/extensions/default/src/getToolbarModule.js b/extensions/default/src/getToolbarModule.js
index 3cf8b00c0..e6f855057 100644
--- a/extensions/default/src/getToolbarModule.js
+++ b/extensions/default/src/getToolbarModule.js
@@ -9,8 +9,8 @@ const definitions = [
id: 'Layout',
label: 'Layout',
icon: 'tool-layout',
- commandName: TOOLBAR_BUTTON_TYPES.SET_TOOL_ACTIVE,
- commandOptions: { toolName: 'Layout' }, // TODO
+ commandName: 'toggleLayoutSelectionDialog',
+ commandOptions: { },
},
];
diff --git a/extensions/default/src/index.js b/extensions/default/src/index.js
index a426be014..8099cde61 100644
--- a/extensions/default/src/index.js
+++ b/extensions/default/src/index.js
@@ -1,3 +1,4 @@
+import getCommandsModule from './getCommandsModule.js';
import getContextModule from './getContextModule.js';
import getDataSourcesModule from './getDataSourcesModule.js';
import getLayoutTemplateModule from './getLayoutTemplateModule.js';
@@ -11,6 +12,7 @@ export default {
* Only required property. Should be a unique value across all extensions.
*/
id,
+ getCommandsModule,
getContextModule,
getDataSourcesModule,
getLayoutTemplateModule,
diff --git a/platform/viewer/src/App.jsx b/platform/viewer/src/App.jsx
index 46014c33b..9d7bb74e8 100644
--- a/platform/viewer/src/App.jsx
+++ b/platform/viewer/src/App.jsx
@@ -48,17 +48,39 @@ function App({ config, defaultExtensions }) {
);
const { UIDialogService, UIModalService, UINotificationService } = servicesManager.services;
+ // A UI Service may need to use the ViewportGrid context
+ const viewportGridReducer = (state, action) => {
+ console.log(state, action);
+
+ switch (action.type) {
+ case 'DO_TODO':
+ return state;
+ default:
+ return action.payload;
+ }
+ };
+
return (
-
-
-
- {appRoutes}
-
-
-
+
+
+
+
+ {appRoutes}
+
+
+
+
diff --git a/platform/viewer/src/routes/Mode/Mode.jsx b/platform/viewer/src/routes/Mode/Mode.jsx
index 615bd5817..80a2cf874 100644
--- a/platform/viewer/src/routes/Mode/Mode.jsx
+++ b/platform/viewer/src/routes/Mode/Mode.jsx
@@ -6,7 +6,6 @@ import { DicomMetadataStore, ToolBarManager } from '@ohif/core';
import {
DragAndDropProvider,
ImageViewerProvider,
- ViewportGridProvider,
} from '@ohif/ui';
//
import { useQuery } from '@hooks';
@@ -123,44 +122,23 @@ export default function ModeRoute({
console.log(state, action);
};
- const viewportGridReducer = (state, action) => {
- console.log(state, action);
-
- switch (action.type) {
- case 'DO_TODO':
- return state;
- default:
- return action.payload;
- }
- };
-
return (
-
-
- {/* TODO: extensionManager is already provided to the extension module.
- * Use it from there instead of passing as a prop here.
- */}
-
-
-
-
-
+
+ {/* TODO: extensionManager is already provided to the extension module.
+ * Use it from there instead of passing as a prop here.
+ */}
+
+
+
+
);
}