2019-06-06 20:41:31 +02:00
|
|
|
import './Header.css';
|
|
|
|
|
|
2019-05-30 06:46:45 +02:00
|
|
|
import { Link, withRouter } from 'react-router-dom';
|
2019-06-06 20:41:31 +02:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
|
|
2019-05-30 06:46:45 +02:00
|
|
|
import { Dropdown } from 'react-viewerbase';
|
|
|
|
|
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
2019-06-06 20:41:31 +02:00
|
|
|
import PropTypes from 'prop-types';
|
2019-06-06 21:01:32 +02:00
|
|
|
// import { UserPreferencesModal } from 'react-viewerbase';
|
2019-06-06 20:41:31 +02:00
|
|
|
import { hotkeysManager } from './../../App.js';
|
2019-01-08 10:48:57 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
class Header extends Component {
|
|
|
|
|
static propTypes = {
|
|
|
|
|
home: PropTypes.bool.isRequired,
|
|
|
|
|
location: PropTypes.object.isRequired,
|
2019-05-28 19:19:06 +02:00
|
|
|
children: PropTypes.node,
|
2019-05-30 06:46:45 +02:00
|
|
|
};
|
2019-01-24 14:00:01 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
static defaultProps = {
|
|
|
|
|
home: true,
|
2019-05-28 19:19:06 +02:00
|
|
|
children: OHIFLogo(),
|
2019-05-30 06:46:45 +02:00
|
|
|
};
|
2019-01-31 08:55:05 +01:00
|
|
|
|
2019-06-06 20:41:31 +02:00
|
|
|
// onSave: data => {
|
|
|
|
|
// const contextName = window.store.getState().commandContext.context;
|
|
|
|
|
// const preferences = cloneDeep(window.store.getState().preferences);
|
|
|
|
|
// preferences[contextName] = data;
|
|
|
|
|
// dispatch(setUserPreferences(preferences));
|
|
|
|
|
// dispatch(setUserPreferencesModalOpen(false));
|
|
|
|
|
// OHIF.hotkeysUtil.setHotkeys(data.hotKeysData);
|
|
|
|
|
// },
|
|
|
|
|
// onResetToDefaults: () => {
|
|
|
|
|
// dispatch(setUserPreferences());
|
|
|
|
|
// dispatch(setUserPreferencesModalOpen(false));
|
|
|
|
|
// OHIF.hotkeysUtil.setHotkeys();
|
|
|
|
|
// },
|
|
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
constructor(props) {
|
2019-05-30 06:46:45 +02:00
|
|
|
super(props);
|
2019-06-06 20:41:31 +02:00
|
|
|
this.state = { isUserPreferencesOpen: false };
|
2019-01-31 08:55:05 +01:00
|
|
|
|
2019-06-06 20:41:31 +02:00
|
|
|
const onClick = this.toggleUserPreferences.bind(this);
|
2019-01-31 08:55:05 +01:00
|
|
|
|
|
|
|
|
this.options = [
|
2019-06-06 21:01:32 +02:00
|
|
|
// {
|
|
|
|
|
// title: 'Preferences ',
|
|
|
|
|
// icon: {
|
|
|
|
|
// name: 'user',
|
|
|
|
|
// },
|
|
|
|
|
// onClick: onClick,
|
|
|
|
|
// },
|
2019-01-31 08:55:05 +01:00
|
|
|
{
|
|
|
|
|
title: 'About',
|
2019-05-28 19:18:40 +02:00
|
|
|
icon: {
|
|
|
|
|
name: 'info',
|
|
|
|
|
},
|
|
|
|
|
link: 'http://ohif.org',
|
|
|
|
|
},
|
2019-05-30 06:46:45 +02:00
|
|
|
];
|
2019-06-06 20:41:31 +02:00
|
|
|
|
|
|
|
|
this.hotKeysData = hotkeysManager.hotkeyDefinitions;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleUserPreferences() {
|
|
|
|
|
const isOpen = this.state.isUserPreferencesOpen;
|
|
|
|
|
|
|
|
|
|
this.setState({
|
|
|
|
|
isUserPreferencesOpen: !isOpen,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onUserPreferencesSave({ windowLevelData, hotKeysData }) {
|
|
|
|
|
console.log(windowLevelData);
|
|
|
|
|
console.log(hotKeysData);
|
|
|
|
|
|
|
|
|
|
// TODO: Update hotkeysManager
|
|
|
|
|
// TODO: reset `this.hotKeysData`
|
2019-01-24 14:00:01 +01:00
|
|
|
}
|
2019-01-01 12:23:17 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
render() {
|
|
|
|
|
return (
|
|
|
|
|
<div className={`entry-header ${this.props.home ? 'header-big' : ''}`}>
|
|
|
|
|
<div className="header-left-box">
|
|
|
|
|
{this.props.location && this.props.location.studyLink && (
|
|
|
|
|
<Link
|
|
|
|
|
to={this.props.location.studyLink}
|
|
|
|
|
className="header-btn header-viewerLink"
|
|
|
|
|
>
|
|
|
|
|
Back to Viewer
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
2018-12-29 15:02:18 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
{this.props.children}
|
2018-12-29 15:02:18 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
{!this.props.home && (
|
|
|
|
|
<Link
|
|
|
|
|
className="header-btn header-studyListLinkSection"
|
|
|
|
|
to={{
|
|
|
|
|
pathname: '/',
|
2019-05-28 19:19:06 +02:00
|
|
|
state: { studyLink: this.props.location.pathname },
|
2019-01-31 08:55:05 +01:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Study list
|
|
|
|
|
</Link>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
2019-01-08 10:48:57 +01:00
|
|
|
|
2019-01-31 08:55:05 +01:00
|
|
|
<div className="header-menu">
|
|
|
|
|
<span className="research-use">INVESTIGATIONAL USE ONLY</span>
|
|
|
|
|
<Dropdown title="Options" list={this.options} align="right" />
|
2019-06-06 21:01:32 +02:00
|
|
|
{/* <UserPreferencesModal
|
2019-06-06 20:41:31 +02:00
|
|
|
isOpen={this.state.isUserPreferencesOpen}
|
|
|
|
|
onCancel={this.toggleUserPreferences.bind(this)}
|
|
|
|
|
onSave={this.toggleUserPreferences.bind(this)}
|
|
|
|
|
onResetToDefaults={this.toggleUserPreferences.bind(this)}
|
|
|
|
|
windowLevelData={{}}
|
|
|
|
|
hotKeysData={this.hotKeysData}
|
2019-06-06 21:01:32 +02:00
|
|
|
/> */}
|
2019-01-31 08:55:05 +01:00
|
|
|
</div>
|
|
|
|
|
</div>
|
2019-05-30 06:46:45 +02:00
|
|
|
);
|
2019-01-31 08:55:05 +01:00
|
|
|
}
|
|
|
|
|
}
|
2019-01-08 10:48:57 +01:00
|
|
|
|
2019-05-30 06:46:45 +02:00
|
|
|
export default withRouter(Header);
|