import React, { Component } from 'react'
import PropTypes from 'prop-types'
import OHIF from 'ohif-core'
import { RoundedButtonGroup, Icon } from 'react-viewerbase'
import ConnectedLayoutButton from './ConnectedLayoutButton'
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js'
import './ToolbarRow.css'
class ToolbarRow extends Component {
static propTypes = {
leftSidebarOpen: PropTypes.bool.isRequired,
rightSidebarOpen: PropTypes.bool.isRequired,
setLeftSidebarOpen: PropTypes.func,
setRightSidebarOpen: PropTypes.func,
pluginId: PropTypes.string,
}
static defaultProps = {
leftSidebarOpen: false,
rightSidebarOpen: false,
}
onLeftSidebarValueChanged = value => {
this.props.setLeftSidebarOpen(!!value)
}
onRightSidebarValueChanged = value => {
this.props.setRightSidebarOpen(!!value)
}
render() {
const leftSidebarToggle = [
{
value: 'studies',
icon: {
name: 'studies',
width: 15,
height: 13,
},
bottomLabel: 'Series',
},
]
const rightSidebarToggle = [
{
value: 'measurements',
icon: {
name: 'measurement-lesions',
width: 15,
height: 13,
},
bottomLabel: 'Measurements',
},
]
const leftSidebarValue = this.props.leftSidebarOpen
? leftSidebarToggle[0].value
: null
const rightSidebarValue = this.props.rightSidebarOpen
? rightSidebarToggle[0].value
: null
const currentPluginId = this.props.pluginId
const { PLUGIN_TYPES, availablePlugins } = OHIF.plugins
const plugin = availablePlugins.find(entry => {
return entry.type === PLUGIN_TYPES.TOOLBAR && entry.id === currentPluginId
})
let pluginComp
if (plugin) {
const PluginComponent = plugin.component
pluginComp =