import React, { useState } from 'react';
import { SidePanel, NavBar, Svg, Icon, IconButton, Toolbar } from '@ohif/ui';
import {
HelloWorldContext,
AnotherHelloWorldContext,
} from './getContextModule';
export default function() {
return [
// Layout Template Definition
// TODO: this is weird naming
{
name: 'viewerLayout',
id: 'viewerLayout',
component: viewerLayout,
},
];
}
const Header = ({ tools, moreTools }) => {
const [activeTool, setActiveTool] = useState('Zoom');
const dropdownContent = [
{
name: 'Soft tissue',
value: '400/40',
},
{ name: 'Lung', value: '1500 / -600' },
{ name: 'Liver', value: '150 / 90' },
{ name: 'Bone', value: '2500 / 480' },
{ name: 'Brain', value: '80 / 40' },
];
// TODO -> In ToolBarManager => Consume commandName and commandOptions and create onClick?
/*
const tools = [
{
id: 'Zoom',
label: 'Zoom',
icon: 'tool-zoom',
commandName: 'setToolActive',
commandOptions: { toolName: 'Zoom' },
onClick: () => setActiveTool('Zoom'),
},
{
id: 'Wwwc',
label: 'Levels',
icon: 'tool-window-level',
commandName: 'setToolActive',
commandOptions: { toolName: 'Wwwc' },
onClick: () => setActiveTool('Wwwc'),
dropdownContent: (
{dropdownContent.map((row, i) => (
{row.name}
{row.value}
{i}
))}
),
},
{
id: 'Pan',
label: 'Pan',
icon: 'tool-move',
commandName: 'setToolActive',
commandOptions: { toolName: 'Pan' },
onClick: () => setActiveTool('Pan'),
},
{
id: 'Capture',
label: 'Capture',
icon: 'tool-capture',
commandName: 'setToolActive',
commandOptions: { toolName: 'Capture' },
onClick: () => setActiveTool('Capture'),
},
{
id: 'Layout',
label: 'Layout',
icon: 'tool-layout',
commandName: 'setToolActive',
commandOptions: { toolName: 'Layout' },
onClick: () => setActiveTool('Layout'),
},
];
*/
return (
alert('Navigate to previous page')}
/>
FOR INVESTIGATIONAL USE ONLY
{}}
>
);
};
const ViewportToolbar = ({ tools }) => {
// const tools = [
// {
// id: 'Annotate',
// label: 'Annotate',
// icon: 'tool-annotate',
// type: null,
// commandName: 'setToolActive',
// commandOptions: { toolName: 'Annotate' },
// onClick: () => console.log('Activate Annotate'),
// },
// {
// id: 'Bidirectional',
// label: 'Bidirectional',
// icon: 'tool-bidirectional',
// type: null,
// commandName: 'setToolActive',
// commandOptions: { toolName: 'Bidirectional' },
// onClick: () => console.log('Activate Bidirectional'),
// },
// {
// id: 'Elipse',
// label: 'Elipse',
// icon: 'tool-elipse',
// type: null,
// commandName: 'setToolActive',
// commandOptions: { toolName: 'Elipse' },
// onClick: () => console.log('Activate Elipse'),
// },
// {
// id: 'Length',
// label: 'Length',
// icon: 'tool-length',
// type: null,
// commandName: 'setToolActive',
// commandOptions: { toolName: 'Length' },
// onClick: () => console.log('Activate Length'),
// },
// ];
return ;
};
function viewerLayout({
leftPanels,
rightPanels,
extensionManager,
toolBarLayout,
displaySetInstanceUids,
}) {
const getPanelData = id => {
const entry = extensionManager.getModuleEntry(id);
// TODO, not sure why sidepanel content has to be JSX, and not a children prop?
const content = entry.component({});
return {
iconName: entry.iconName,
iconLabel: entry.iconLabel,
label: entry.label,
name: entry.name,
content,
};
};
const leftPanelComponents = leftPanels.map(getPanelData);
const rightPanelComponents = rightPanels.map(getPanelData);
console.warn(displaySetInstanceUids);
console.warn(toolBarLayout);
const [primaryToolBarLayout, secondaryToolBarLayout] = toolBarLayout;
return (
{/*
alert(`Series ${direction}`)}
studyData={{
label: 'A',
isTracked: true,
isLocked: false,
studyDate: '07-Sep-2011',
currentSeries: 1,
seriesDescription:
'Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ',
modality: 'CT',
patientInformation: {
patientName: 'Smith, Jane',
patientSex: 'F',
patientAge: '59',
MRN: '10000001',
thickness: '5.0mm',
spacing: '1.25mm',
scanner: 'Aquilion',
},
}}
>
CONTENT
,
alert(`Series ${direction}`)}
studyData={{
label: 'A',
isTracked: false,
isLocked: true,
studyDate: '07-Sep-2010',
currentSeries: 2,
seriesDescription:
'Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit Series description lorem ipsum dolor sit ',
modality: 'SR',
patientInformation: {
patientName: 'Smith, Jane',
patientSex: 'F',
patientAge: '59',
MRN: '10000001',
thickness: '2.0mm',
spacing: '1.25mm',
scanner: 'Aquilion',
},
}}
>
CONTENT
,
]}
setActiveViewportIndex={setActiveViewportIndex}
activeViewportIndex={activeViewportIndex}
/>*/}
);
}
viewerLayout.defaultProps = {
toolBarLayout: [
{ tools: [], moreTools: [] },
{ tools: [], moreTools: [] },
],
};