Re-apply semicolons
This commit is contained in:
parent
ffbd6ad6e4
commit
c16654514d
@ -1,10 +1,10 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types';
|
||||||
import { Link, withRouter } from 'react-router-dom'
|
import { Link, withRouter } from 'react-router-dom';
|
||||||
import { Dropdown } from 'react-viewerbase'
|
import { Dropdown } from 'react-viewerbase';
|
||||||
import './Header.css'
|
import './Header.css';
|
||||||
import OHIFLogo from '../OHIFLogo/OHIFLogo.js'
|
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
||||||
import ConnectedUserPreferencesModal from '../../connectedComponents/ConnectedUserPreferencesModal.js'
|
import ConnectedUserPreferencesModal from '../../connectedComponents/ConnectedUserPreferencesModal.js';
|
||||||
|
|
||||||
class Header extends Component {
|
class Header extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -12,19 +12,19 @@ class Header extends Component {
|
|||||||
location: PropTypes.object.isRequired,
|
location: PropTypes.object.isRequired,
|
||||||
openUserPreferencesModal: PropTypes.func,
|
openUserPreferencesModal: PropTypes.func,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
}
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
home: true,
|
home: true,
|
||||||
children: OHIFLogo(),
|
children: OHIFLogo(),
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
userPreferencesOpen: false,
|
userPreferencesOpen: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
@ -41,7 +41,7 @@ class Header extends Component {
|
|||||||
},
|
},
|
||||||
link: 'http://ohif.org',
|
link: 'http://ohif.org',
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -78,8 +78,8 @@ class Header extends Component {
|
|||||||
<ConnectedUserPreferencesModal />
|
<ConnectedUserPreferencesModal />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withRouter(Header)
|
export default withRouter(Header);
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react';
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
import cloneDeep from 'lodash.clonedeep'
|
import cloneDeep from 'lodash.clonedeep';
|
||||||
import bounding from '../../lib/utils/bounding.js'
|
import bounding from '../../lib/utils/bounding.js';
|
||||||
|
|
||||||
import LabellingTransition from './LabellingTransition.js'
|
import LabellingTransition from './LabellingTransition.js';
|
||||||
import { SelectTree, Icon } from 'react-viewerbase'
|
import { SelectTree, Icon } from 'react-viewerbase';
|
||||||
import { getAddLabelButtonStyle } from './labellingPositionUtils.js'
|
import { getAddLabelButtonStyle } from './labellingPositionUtils.js';
|
||||||
|
|
||||||
import OHIFLabellingData from './OHIFLabellingData.js'
|
import OHIFLabellingData from './OHIFLabellingData.js';
|
||||||
|
|
||||||
export default class LabellingFlow extends Component {
|
export default class LabellingFlow extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -21,16 +21,16 @@ export default class LabellingFlow extends Component {
|
|||||||
skipAddLabelButton: PropTypes.bool,
|
skipAddLabelButton: PropTypes.bool,
|
||||||
editLocation: PropTypes.bool,
|
editLocation: PropTypes.bool,
|
||||||
editDescription: PropTypes.bool,
|
editDescription: PropTypes.bool,
|
||||||
}
|
};
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props);
|
||||||
|
|
||||||
const { location, locationLabel, description } = props.measurementData
|
const { location, locationLabel, description } = props.measurementData;
|
||||||
|
|
||||||
let style = props.componentStyle
|
let style = props.componentStyle;
|
||||||
if (!props.skipAddLabelButton) {
|
if (!props.skipAddLabelButton) {
|
||||||
style = getAddLabelButtonStyle(props.measurementData, props.eventData)
|
style = getAddLabelButtonStyle(props.measurementData, props.eventData);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
@ -43,28 +43,28 @@ export default class LabellingFlow extends Component {
|
|||||||
componentStyle: style,
|
componentStyle: style,
|
||||||
confirmationState: false,
|
confirmationState: false,
|
||||||
displayComponent: true,
|
displayComponent: true,
|
||||||
}
|
};
|
||||||
|
|
||||||
this.mainElement = React.createRef()
|
this.mainElement = React.createRef();
|
||||||
this.descriptionInput = React.createRef()
|
this.descriptionInput = React.createRef();
|
||||||
|
|
||||||
this.initialItems = OHIFLabellingData
|
this.initialItems = OHIFLabellingData;
|
||||||
this.currentItems = cloneDeep(this.initialItems)
|
this.currentItems = cloneDeep(this.initialItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = () => {
|
componentDidUpdate = () => {
|
||||||
this.repositionComponent()
|
this.repositionComponent();
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
let mainElementClassName = 'labellingComponent'
|
let mainElementClassName = 'labellingComponent';
|
||||||
if (this.state.editDescription) {
|
if (this.state.editDescription) {
|
||||||
mainElementClassName += ' editDescription'
|
mainElementClassName += ' editDescription';
|
||||||
}
|
}
|
||||||
|
|
||||||
const style = Object.assign({}, this.state.componentStyle)
|
const style = Object.assign({}, this.state.componentStyle);
|
||||||
if (this.state.skipAddLabelButton) {
|
if (this.state.skipAddLabelButton) {
|
||||||
style.left -= 160
|
style.left -= 160;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -82,7 +82,7 @@ export default class LabellingFlow extends Component {
|
|||||||
{this.labellingStateFragment()}
|
{this.labellingStateFragment()}
|
||||||
</div>
|
</div>
|
||||||
</LabellingTransition>
|
</LabellingTransition>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
labellingStateFragment = () => {
|
labellingStateFragment = () => {
|
||||||
@ -91,7 +91,7 @@ export default class LabellingFlow extends Component {
|
|||||||
editLocation,
|
editLocation,
|
||||||
description,
|
description,
|
||||||
locationLabel,
|
locationLabel,
|
||||||
} = this.state
|
} = this.state;
|
||||||
|
|
||||||
if (!skipAddLabelButton) {
|
if (!skipAddLabelButton) {
|
||||||
return (
|
return (
|
||||||
@ -104,7 +104,7 @@ export default class LabellingFlow extends Component {
|
|||||||
{this.state.location ? 'Edit' : 'Add'} Label
|
{this.state.location ? 'Edit' : 'Add'} Label
|
||||||
</button>
|
</button>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
if (editLocation) {
|
if (editLocation) {
|
||||||
return (
|
return (
|
||||||
@ -115,7 +115,7 @@ export default class LabellingFlow extends Component {
|
|||||||
selectTreeFirstTitle="Assign Label"
|
selectTreeFirstTitle="Assign Label"
|
||||||
onComponentChange={this.repositionComponent}
|
onComponentChange={this.repositionComponent}
|
||||||
/>
|
/>
|
||||||
)
|
);
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -170,53 +170,53 @@ export default class LabellingFlow extends Component {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
relabel = () => {
|
relabel = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
editLocation: true,
|
editLocation: true,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
setDescriptionUpdateMode = () => {
|
setDescriptionUpdateMode = () => {
|
||||||
this.descriptionInput.current.focus()
|
this.descriptionInput.current.focus();
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editDescription: true,
|
editDescription: true,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
descriptionCancel = () => {
|
descriptionCancel = () => {
|
||||||
const { description = '' } = cloneDeep(this.state)
|
const { description = '' } = cloneDeep(this.state);
|
||||||
this.descriptionInput.current.value = description
|
this.descriptionInput.current.value = description;
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editDescription: false,
|
editDescription: false,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
descriptionSave = () => {
|
descriptionSave = () => {
|
||||||
const description = this.descriptionInput.current.value
|
const description = this.descriptionInput.current.value;
|
||||||
this.props.updateLabelling({ description })
|
this.props.updateLabelling({ description });
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
description,
|
description,
|
||||||
editDescription: false,
|
editDescription: false,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
selectTreeSelectCalback = (event, itemSelected) => {
|
selectTreeSelectCalback = (event, itemSelected) => {
|
||||||
const location = itemSelected.value
|
const location = itemSelected.value;
|
||||||
this.props.updateLabelling({ location })
|
this.props.updateLabelling({ location });
|
||||||
|
|
||||||
const viewportTopPosition = this.mainElement.current.offsetParent.offsetTop
|
const viewportTopPosition = this.mainElement.current.offsetParent.offsetTop;
|
||||||
const componentStyle = {
|
const componentStyle = {
|
||||||
top: event.nativeEvent.y - viewportTopPosition - 25,
|
top: event.nativeEvent.y - viewportTopPosition - 25,
|
||||||
left: this.state.componentStyle.left,
|
left: this.state.componentStyle.left,
|
||||||
}
|
};
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
editLocation: false,
|
editLocation: false,
|
||||||
@ -224,51 +224,51 @@ export default class LabellingFlow extends Component {
|
|||||||
location: itemSelected.value,
|
location: itemSelected.value,
|
||||||
locationLabel: itemSelected.label,
|
locationLabel: itemSelected.label,
|
||||||
componentStyle,
|
componentStyle,
|
||||||
})
|
});
|
||||||
|
|
||||||
if (this.isTouchScreen) {
|
if (this.isTouchScreen) {
|
||||||
this.setTimeout = setTimeout(() => {
|
this.setTimeout = setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
displayComponent: false,
|
displayComponent: false,
|
||||||
})
|
});
|
||||||
}, 2000)
|
}, 2000);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
showLabelling = () => {
|
showLabelling = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
skipAddLabelButton: true,
|
skipAddLabelButton: true,
|
||||||
editLocation: false,
|
editLocation: false,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
fadeOutAndLeave = () => {
|
fadeOutAndLeave = () => {
|
||||||
// Wait for 1 sec to dismiss the labelling component
|
// Wait for 1 sec to dismiss the labelling component
|
||||||
this.fadeOutTimer = setTimeout(() => {
|
this.fadeOutTimer = setTimeout(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
displayComponent: false,
|
displayComponent: false,
|
||||||
})
|
});
|
||||||
}, 1000)
|
}, 1000);
|
||||||
}
|
};
|
||||||
|
|
||||||
fadeOutAndLeaveFast = () => {
|
fadeOutAndLeaveFast = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
displayComponent: false,
|
displayComponent: false,
|
||||||
})
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
clearFadeOutTimer = () => {
|
clearFadeOutTimer = () => {
|
||||||
if (!this.fadeOutTimer) {
|
if (!this.fadeOutTimer) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clearTimeout(this.fadeOutTimer)
|
clearTimeout(this.fadeOutTimer);
|
||||||
}
|
};
|
||||||
|
|
||||||
repositionComponent = () => {
|
repositionComponent = () => {
|
||||||
// SetTimeout for the css animation to end.
|
// SetTimeout for the css animation to end.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
bounding(this.mainElement)
|
bounding(this.mainElement);
|
||||||
}, 200)
|
}, 200);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import './OHIFLogo.css'
|
import './OHIFLogo.css';
|
||||||
|
|
||||||
import { Icon } from 'react-viewerbase'
|
import { Icon } from 'react-viewerbase';
|
||||||
import React from 'react'
|
import React from 'react';
|
||||||
|
|
||||||
function OHIFLogo() {
|
function OHIFLogo() {
|
||||||
return (
|
return (
|
||||||
@ -14,7 +14,7 @@ function OHIFLogo() {
|
|||||||
<Icon name="ohif-logo" className="header-logo-image" />
|
<Icon name="ohif-logo" className="header-logo-image" />
|
||||||
<div className="header-logo-text">Open Health Imaging Foundation</div>
|
<div className="header-logo-text">Open Health Imaging Foundation</div>
|
||||||
</a>
|
</a>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default OHIFLogo
|
export default OHIFLogo;
|
||||||
|
|||||||
@ -1,38 +1,38 @@
|
|||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux';
|
||||||
import PluginSwitch from './PluginSwitch.js'
|
import PluginSwitch from './PluginSwitch.js';
|
||||||
import OHIF from 'ohif-core'
|
import OHIF from 'ohif-core';
|
||||||
|
|
||||||
const { setLayout } = OHIF.redux.actions
|
const { setLayout } = OHIF.redux.actions;
|
||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
const { activeViewportIndex, layout } = state.viewports
|
const { activeViewportIndex, layout } = state.viewports;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeViewportIndex,
|
activeViewportIndex,
|
||||||
layout,
|
layout,
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
setLayout: data => {
|
setLayout: data => {
|
||||||
dispatch(setLayout(data))
|
dispatch(setLayout(data));
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
function setSingleLayoutData(originalArray, viewportIndex, data) {
|
function setSingleLayoutData(originalArray, viewportIndex, data) {
|
||||||
const viewports = originalArray.slice()
|
const viewports = originalArray.slice();
|
||||||
const layoutData = Object.assign({}, viewports[viewportIndex], data)
|
const layoutData = Object.assign({}, viewports[viewportIndex], data);
|
||||||
|
|
||||||
viewports[viewportIndex] = layoutData
|
viewports[viewportIndex] = layoutData;
|
||||||
|
|
||||||
return viewports
|
return viewports;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
||||||
const { activeViewportIndex, layout } = propsFromState
|
const { activeViewportIndex, layout } = propsFromState;
|
||||||
const { setLayout } = propsFromDispatch
|
const { setLayout } = propsFromDispatch;
|
||||||
|
|
||||||
// TODO: Do not display certain options if the current display set
|
// TODO: Do not display certain options if the current display set
|
||||||
// cannot be displayed using these view types
|
// cannot be displayed using these view types
|
||||||
@ -43,15 +43,15 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
|||||||
icon: 'bars',
|
icon: 'bars',
|
||||||
active: false,
|
active: false,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.warn('Original Acquisition')
|
console.warn('Original Acquisition');
|
||||||
|
|
||||||
const layoutData = setSingleLayoutData(
|
const layoutData = setSingleLayoutData(
|
||||||
layout.viewports,
|
layout.viewports,
|
||||||
activeViewportIndex,
|
activeViewportIndex,
|
||||||
{ plugin: 'cornerstone' }
|
{ plugin: 'cornerstone' }
|
||||||
)
|
);
|
||||||
|
|
||||||
setLayout({ viewports: layoutData })
|
setLayout({ viewports: layoutData });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -59,22 +59,22 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
|||||||
icon: 'cube',
|
icon: 'cube',
|
||||||
active: false,
|
active: false,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.warn('Axial')
|
console.warn('Axial');
|
||||||
const data = {
|
const data = {
|
||||||
plugin: 'vtk',
|
plugin: 'vtk',
|
||||||
vtk: {
|
vtk: {
|
||||||
mode: 'mpr',
|
mode: 'mpr',
|
||||||
sliceNormal: [0, 0, 1],
|
sliceNormal: [0, 0, 1],
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
const layoutData = setSingleLayoutData(
|
const layoutData = setSingleLayoutData(
|
||||||
layout.viewports,
|
layout.viewports,
|
||||||
activeViewportIndex,
|
activeViewportIndex,
|
||||||
data
|
data
|
||||||
)
|
);
|
||||||
|
|
||||||
setLayout({ viewports: layoutData })
|
setLayout({ viewports: layoutData });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -82,22 +82,22 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
|||||||
icon: 'cube',
|
icon: 'cube',
|
||||||
active: false,
|
active: false,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.warn('Sagittal')
|
console.warn('Sagittal');
|
||||||
const data = {
|
const data = {
|
||||||
plugin: 'vtk',
|
plugin: 'vtk',
|
||||||
vtk: {
|
vtk: {
|
||||||
mode: 'mpr',
|
mode: 'mpr',
|
||||||
sliceNormal: [1, 0, 0],
|
sliceNormal: [1, 0, 0],
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
const layoutData = setSingleLayoutData(
|
const layoutData = setSingleLayoutData(
|
||||||
layout.viewports,
|
layout.viewports,
|
||||||
activeViewportIndex,
|
activeViewportIndex,
|
||||||
data
|
data
|
||||||
)
|
);
|
||||||
|
|
||||||
setLayout({ viewports: layoutData })
|
setLayout({ viewports: layoutData });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -105,22 +105,22 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
|||||||
icon: 'cube',
|
icon: 'cube',
|
||||||
active: false,
|
active: false,
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
console.warn('Coronal')
|
console.warn('Coronal');
|
||||||
const data = {
|
const data = {
|
||||||
plugin: 'vtk',
|
plugin: 'vtk',
|
||||||
vtk: {
|
vtk: {
|
||||||
mode: 'mpr',
|
mode: 'mpr',
|
||||||
sliceNormal: [0, 1, 0],
|
sliceNormal: [0, 1, 0],
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
const layoutData = setSingleLayoutData(
|
const layoutData = setSingleLayoutData(
|
||||||
layout.viewports,
|
layout.viewports,
|
||||||
activeViewportIndex,
|
activeViewportIndex,
|
||||||
data
|
data
|
||||||
)
|
);
|
||||||
|
|
||||||
setLayout({ viewports: layoutData })
|
setLayout({ viewports: layoutData });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
/*{
|
/*{
|
||||||
@ -140,17 +140,17 @@ const mergeProps = (propsFromState, propsFromDispatch, ownProps) => {
|
|||||||
setLayout({ viewports: layoutData });
|
setLayout({ viewports: layoutData });
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
]
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
buttons,
|
buttons,
|
||||||
}
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
const ConnectedPluginSwitch = connect(
|
const ConnectedPluginSwitch = connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps,
|
mapDispatchToProps,
|
||||||
mergeProps
|
mergeProps
|
||||||
)(PluginSwitch)
|
)(PluginSwitch);
|
||||||
|
|
||||||
export default ConnectedPluginSwitch
|
export default ConnectedPluginSwitch;
|
||||||
|
|||||||
@ -1,12 +1,12 @@
|
|||||||
import './ToolbarRow.css'
|
import './ToolbarRow.css';
|
||||||
|
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
import ConnectedLayoutButton from './ConnectedLayoutButton'
|
import ConnectedLayoutButton from './ConnectedLayoutButton';
|
||||||
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js'
|
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js';
|
||||||
import OHIF from 'ohif-core'
|
import OHIF from 'ohif-core';
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types';
|
||||||
import { RoundedButtonGroup } from 'react-viewerbase'
|
import { RoundedButtonGroup } from 'react-viewerbase';
|
||||||
|
|
||||||
class ToolbarRow extends Component {
|
class ToolbarRow extends Component {
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
@ -15,20 +15,20 @@ class ToolbarRow extends Component {
|
|||||||
setLeftSidebarOpen: PropTypes.func,
|
setLeftSidebarOpen: PropTypes.func,
|
||||||
setRightSidebarOpen: PropTypes.func,
|
setRightSidebarOpen: PropTypes.func,
|
||||||
pluginId: PropTypes.string,
|
pluginId: PropTypes.string,
|
||||||
}
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
leftSidebarOpen: false,
|
leftSidebarOpen: false,
|
||||||
rightSidebarOpen: false,
|
rightSidebarOpen: false,
|
||||||
}
|
};
|
||||||
|
|
||||||
onLeftSidebarValueChanged = value => {
|
onLeftSidebarValueChanged = value => {
|
||||||
this.props.setLeftSidebarOpen(!!value)
|
this.props.setLeftSidebarOpen(!!value);
|
||||||
}
|
};
|
||||||
|
|
||||||
onRightSidebarValueChanged = value => {
|
onRightSidebarValueChanged = value => {
|
||||||
this.props.setRightSidebarOpen(!!value)
|
this.props.setRightSidebarOpen(!!value);
|
||||||
}
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const leftSidebarToggle = [
|
const leftSidebarToggle = [
|
||||||
@ -37,7 +37,7 @@ class ToolbarRow extends Component {
|
|||||||
icon: 'th-large',
|
icon: 'th-large',
|
||||||
bottomLabel: 'Series',
|
bottomLabel: 'Series',
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
const rightSidebarToggle = [
|
const rightSidebarToggle = [
|
||||||
{
|
{
|
||||||
@ -45,28 +45,30 @@ class ToolbarRow extends Component {
|
|||||||
icon: 'list',
|
icon: 'list',
|
||||||
bottomLabel: 'Measurements',
|
bottomLabel: 'Measurements',
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
|
|
||||||
const leftSidebarValue = this.props.leftSidebarOpen
|
const leftSidebarValue = this.props.leftSidebarOpen
|
||||||
? leftSidebarToggle[0].value
|
? leftSidebarToggle[0].value
|
||||||
: null
|
: null;
|
||||||
|
|
||||||
const rightSidebarValue = this.props.rightSidebarOpen
|
const rightSidebarValue = this.props.rightSidebarOpen
|
||||||
? rightSidebarToggle[0].value
|
? rightSidebarToggle[0].value
|
||||||
: null
|
: null;
|
||||||
|
|
||||||
const currentPluginId = this.props.pluginId
|
const currentPluginId = this.props.pluginId;
|
||||||
|
|
||||||
const { PLUGIN_TYPES, availablePlugins } = OHIF.plugins
|
const { PLUGIN_TYPES, availablePlugins } = OHIF.plugins;
|
||||||
const plugin = availablePlugins.find(entry => {
|
const plugin = availablePlugins.find(entry => {
|
||||||
return entry.type === PLUGIN_TYPES.TOOLBAR && entry.id === currentPluginId
|
return (
|
||||||
})
|
entry.type === PLUGIN_TYPES.TOOLBAR && entry.id === currentPluginId
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
let pluginComp
|
let pluginComp;
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
const PluginComponent = plugin.component
|
const PluginComponent = plugin.component;
|
||||||
|
|
||||||
pluginComp = <PluginComponent />
|
pluginComp = <PluginComponent />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -89,8 +91,8 @@ class ToolbarRow extends Component {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ToolbarRow
|
export default ToolbarRow;
|
||||||
|
|||||||
@ -98,5 +98,5 @@ export default function() {
|
|||||||
icon: 'reset',
|
icon: 'reset',
|
||||||
active: false,
|
active: false,
|
||||||
},
|
},
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js'
|
import getDefaultToolbarButtons from './getDefaultToolbarButtons.js';
|
||||||
|
|
||||||
describe('getDefaultToolbarButtons.js', () => {
|
describe('getDefaultToolbarButtons.js', () => {
|
||||||
it('returns a non-empty array', () => {
|
it('returns a non-empty array', () => {
|
||||||
const buttons = getDefaultToolbarButtons()
|
const buttons = getDefaultToolbarButtons();
|
||||||
|
|
||||||
expect(buttons.length).toBeGreaterThan(0)
|
expect(buttons.length).toBeGreaterThan(0);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user