-
-
-
-
-
-
+
+
+
+
-
-
-
- setFilename(event.target.value)}
- label={t('File name')}
- id="file-name"
- />
-
-
-
-
-
-
-
-
-
+
+
-
+
+ setFilename(event.target.value)}
+ label={t('File name')}
+ id="file-name"
+ />
+
+
+
+
+
+
+
+
+
+
+
+
+
setViewportElement(ref)}
+ >
+
+ width={downloadCanvas.width}
+ height={downloadCanvas.height}
+ ref={downloadCanvas.ref}
+ >
+
-
-
{t('Image Preview')}
-

-
+
+
{t('Image Preview')}
+

+
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+ >
);
};
-DownloadDialog.propTypes = {
- t: PropTypes.func.isRequired,
- isOpen: PropTypes.bool.isRequired,
- activeViewport: PropTypes.object,
+ViewportDownloadForm.propTypes = {
onClose: PropTypes.func.isRequired,
+ activeViewport: PropTypes.object,
updateViewportPreview: PropTypes.func.isRequired,
enableViewport: PropTypes.func.isRequired,
disableViewport: PropTypes.func.isRequired,
@@ -338,4 +322,4 @@ DownloadDialog.propTypes = {
canvasClass: PropTypes.string.isRequired,
};
-export default withTranslation('DownloadDialog')(DownloadDialog);
+export default ViewportDownloadForm;
diff --git a/platform/ui/src/components/downloadDialog/DownloadDialog.styl b/platform/ui/src/components/content/viewportDownloadForm/ViewportDownloadForm.styl
similarity index 92%
rename from platform/ui/src/components/downloadDialog/DownloadDialog.styl
rename to platform/ui/src/components/content/viewportDownloadForm/ViewportDownloadForm.styl
index b7ea177a3..a1eb621cf 100644
--- a/platform/ui/src/components/downloadDialog/DownloadDialog.styl
+++ b/platform/ui/src/components/content/viewportDownloadForm/ViewportDownloadForm.styl
@@ -1,8 +1,8 @@
-@import './../../design/styles/common/global.styl'
-@import './../../design/styles/common/form.styl'
-@import './../../design/styles/common/button.styl'
+@import '../../../design/styles/common/global.styl'
+@import '../../../design/styles/common/form.styl'
+@import '../../../design/styles/common/button.styl'
-.DownloadDialog
+.ViewportDownloadForm
color: var(--text-secondary-color);
filter: drop-shadow(0 0 3px var(--ui-gray-darkest));
border: none;
diff --git a/platform/ui/src/components/downloadDialog/__docs__/downloadDialog.mdx b/platform/ui/src/components/content/viewportDownloadForm/__docs__/viewportDownloadForm.mdx
similarity index 67%
rename from platform/ui/src/components/downloadDialog/__docs__/downloadDialog.mdx
rename to platform/ui/src/components/content/viewportDownloadForm/__docs__/viewportDownloadForm.mdx
index 11d442a7a..f5c1422c3 100644
--- a/platform/ui/src/components/downloadDialog/__docs__/downloadDialog.mdx
+++ b/platform/ui/src/components/content/viewportDownloadForm/__docs__/viewportDownloadForm.mdx
@@ -1,15 +1,15 @@
---
-name: Download Dialog
+name: Viewport Download Form
menu: Components
-route: /components/download-dialog
+route: /components/viewport-download-form
---
import { Playground, Props } from 'docz'
import { State } from 'react-powerplug'
-import { DownloadDialog } from './../index'
+import { ViewportDownloadForm } from './../index'
import NameSpace from '../../../__docs__/NameSpace'
-# Download Dialog
+# Viewport Download Form
## Basic usage
@@ -23,7 +23,7 @@ import NameSpace from '../../../__docs__/NameSpace'
{JSON.stringify(state, null, 2)}
-
+
)}
@@ -32,8 +32,8 @@ import NameSpace from '../../../__docs__/NameSpace'
## API
-
+
## Translation Namespace
-
+
diff --git a/platform/ui/src/components/content/viewportDownloadForm/index.js b/platform/ui/src/components/content/viewportDownloadForm/index.js
new file mode 100644
index 000000000..b7026641f
--- /dev/null
+++ b/platform/ui/src/components/content/viewportDownloadForm/index.js
@@ -0,0 +1,2 @@
+import ViewportDownloadForm from './ViewportDownloadForm';
+export { ViewportDownloadForm };
diff --git a/platform/ui/src/components/downloadDialog/index.js b/platform/ui/src/components/downloadDialog/index.js
deleted file mode 100644
index 6cec626bf..000000000
--- a/platform/ui/src/components/downloadDialog/index.js
+++ /dev/null
@@ -1,2 +0,0 @@
-import DownloadDialog from './DownloadDialog';
-export { DownloadDialog };
diff --git a/platform/ui/src/components/index.js b/platform/ui/src/components/index.js
index 11e21e9f1..df935085f 100644
--- a/platform/ui/src/components/index.js
+++ b/platform/ui/src/components/index.js
@@ -4,14 +4,14 @@ import { MeasurementTable, MeasurementTableItem } from './measurementTable';
import { Overlay, OverlayTrigger } from './overlayTrigger';
import { TableList, TableListItem } from './tableList';
import {
- AboutModal,
+ AboutContent,
UserPreferences,
UserPreferencesModal,
} from './userPreferencesModal';
import { Checkbox } from './checkbox';
import { CineDialog } from './cineDialog';
-import { DownloadDialog } from './downloadDialog';
+import { ViewportDownloadForm } from './content/viewportDownloadForm';
import { QuickSwitch } from './quickSwitch';
import { RoundedButtonGroup } from './roundedButtonGroup';
import { SelectTree } from './selectTree';
@@ -29,7 +29,7 @@ import { Tooltip } from './tooltip';
export {
Checkbox,
CineDialog,
- DownloadDialog,
+ ViewportDownloadForm,
LayoutButton,
LayoutChooser,
MeasurementTable,
@@ -50,7 +50,7 @@ export {
TablePagination,
ToolbarSection,
Tooltip,
- AboutModal,
+ AboutContent,
UserPreferences,
UserPreferencesModal,
OHIFModal,
diff --git a/platform/ui/src/components/userPreferencesModal/AboutModal.js b/platform/ui/src/components/userPreferencesModal/AboutModal.js
deleted file mode 100644
index 43aa92031..000000000
--- a/platform/ui/src/components/userPreferencesModal/AboutModal.js
+++ /dev/null
@@ -1,143 +0,0 @@
-import React, { Component } from 'react';
-import PropTypes from 'prop-types';
-import Modal from 'react-bootstrap-modal';
-import detect from 'browser-detect';
-import './AboutModal.styl';
-import { withTranslation } from '../../utils/LanguageProvider';
-
-import 'react-bootstrap-modal/lib/css/rbm-patch.css';
-
-// TODO: Is this the only component importing these?
-import './../../design/styles/common/modal.styl';
-
-class AboutModal extends Component {
- constructor(props) {
- super(props);
- }
- // TODO: Make this component more generic to allow things other than W/L and hotkeys...
- static propTypes = {
- isOpen: PropTypes.bool.isRequired,
- onCancel: PropTypes.func,
- };
-
- itemsPreset() {
- const { t } = this.props;
- const browser = detect();
- const capitalize = s =>
- s.substr(0, 1).toUpperCase() + s.substr(1).toLowerCase();
-
- return [
- {
- name: t('Repository URL'),
- value: 'https://github.com/OHIF/Viewers/',
- link: 'https://github.com/OHIF/Viewers/',
- },
- {
- name: t('Latest Master Commits'),
- value: 'https://github.com/OHIF/Viewers/commits/master',
- link: 'https://github.com/OHIF/Viewers/commits/master',
- },
- {
- name: 'Version Number',
- value: process.env.VERSION_NUMBER,
- },
- {
- name: t('Build Number'),
- value: process.env.BUILD_NUM,
- },
- {
- name: t('Browser'),
- value: `${capitalize(browser.name)} ${browser.version}`,
- },
- {
- name: t('OS'),
- value: browser.os,
- },
- ];
- }
-
- static defaultProps = {
- isOpen: false,
- };
-
- renderTableRow(item) {
- return (
-
- | {item.name} |
-
- {item.link ? (
-
- {item.value}
-
- ) : (
- item.value
- )}
- |
-
- );
- }
-
- render() {
- const { t } = this.props;
- return (
-
-
- {t('OHIF Viewer - About')}
-
-
-
-
-
{t('Version Information')}
-
-
-
- | {t('Name')} |
- {t('Value')} |
-
-
-
- {this.itemsPreset().map(item => this.renderTableRow(item))}
-
-
-
-
-
- );
- }
-}
-
-const connectedComponent = withTranslation('AboutModal')(AboutModal);
-export { connectedComponent as AboutModal };
-export default connectedComponent;
diff --git a/platform/ui/src/components/userPreferencesModal/__docs__/about.mdx b/platform/ui/src/components/userPreferencesModal/__docs__/about.mdx
index 819648ff0..21f22168d 100644
--- a/platform/ui/src/components/userPreferencesModal/__docs__/about.mdx
+++ b/platform/ui/src/components/userPreferencesModal/__docs__/about.mdx
@@ -6,7 +6,7 @@ route: /components/about-modal
import { Playground, Props } from 'docz'
import { State } from 'react-powerplug'
-import { AboutModal } from './../index.js'
+import { AboutContent } from './../index.js'
# About Modal
@@ -26,7 +26,7 @@ import { AboutModal } from './../index.js'
>
Open about modal
-
setState({ isOpen: false })}
/>
@@ -39,4 +39,4 @@ import { AboutModal } from './../index.js'
## API
-
+
diff --git a/platform/ui/src/components/userPreferencesModal/__docs__/hotkeyDefaults.js b/platform/ui/src/components/userPreferencesModal/__docs__/hotkeyDefaults.js
index 1c8399977..64f3f3035 100644
--- a/platform/ui/src/components/userPreferencesModal/__docs__/hotkeyDefaults.js
+++ b/platform/ui/src/components/userPreferencesModal/__docs__/hotkeyDefaults.js
@@ -60,11 +60,6 @@ export default {
keys: [''],
column: 1,
},
- toggleDownloadDialog: {
- label: 'Show/Hide Download Dialog',
- keys: [''],
- column: 1,
- },
// Preset hotkeys
WLPreset0: { label: 'W/L Preset 0 (Soft Tissue)', keys: ['1'], column: 1 },
diff --git a/platform/ui/src/components/userPreferencesModal/index.js b/platform/ui/src/components/userPreferencesModal/index.js
index fa7580d5e..d1a9c2a7b 100644
--- a/platform/ui/src/components/userPreferencesModal/index.js
+++ b/platform/ui/src/components/userPreferencesModal/index.js
@@ -1,4 +1,4 @@
export { UserPreferences } from './UserPreferences.js';
-export { AboutModal } from './AboutModal.js';
+export { AboutContent } from '../content/aboutContent/AboutContent.js';
export { UserPreferencesModal } from './UserPreferencesModal.js';
export { GeneralPreferences } from './GeneralPreferences.js';
diff --git a/platform/ui/src/index.js b/platform/ui/src/index.js
index abb960d0e..c608b4521 100644
--- a/platform/ui/src/index.js
+++ b/platform/ui/src/index.js
@@ -1,7 +1,7 @@
import {
Checkbox,
CineDialog,
- DownloadDialog,
+ ViewportDownloadForm,
LayoutButton,
LayoutChooser,
MeasurementTable,
@@ -22,7 +22,7 @@ import {
TablePagination,
ToolbarSection,
Tooltip,
- AboutModal,
+ AboutContent,
UserPreferences,
UserPreferencesModal,
OHIFModal,
@@ -69,7 +69,7 @@ export {
TextArea,
TextInput,
CineDialog,
- DownloadDialog,
+ ViewportDownloadForm,
ExpandableToolMenu,
Icon,
LayoutButton,
@@ -99,7 +99,7 @@ export {
ToolbarButton,
ToolbarSection,
Tooltip,
- AboutModal,
+ AboutContent,
UserPreferences,
UserPreferencesModal,
ViewerbaseDragDropContext,
diff --git a/platform/viewer/CHANGELOG.md b/platform/viewer/CHANGELOG.md
index dd01cc150..3841c2389 100644
--- a/platform/viewer/CHANGELOG.md
+++ b/platform/viewer/CHANGELOG.md
@@ -3,6 +3,7 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
+
# [2.5.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.4.1...@ohif/viewer@2.5.0) (2019-11-05)
diff --git a/platform/viewer/src/components/Header/Header.js b/platform/viewer/src/components/Header/Header.js
index ab84520f7..a37b136e3 100644
--- a/platform/viewer/src/components/Header/Header.js
+++ b/platform/viewer/src/components/Header/Header.js
@@ -1,15 +1,15 @@
-import './Header.css';
-
-import { Link, withRouter } from 'react-router-dom';
import React, { Component } from 'react';
+import { Link, withRouter } from 'react-router-dom';
+import { withTranslation } from 'react-i18next';
+import PropTypes from 'prop-types';
import { Dropdown } from '@ohif/ui';
-import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
-import PropTypes from 'prop-types';
-import { AboutModal } from '@ohif/ui';
-import { hotkeysManager } from './../../App.js';
-import { withTranslation } from 'react-i18next';
+import { AboutContent } from '@ohif/ui';
+import { withModal } from '@ohif/ui';
+import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
+import { hotkeysManager } from './../../App.js';
+import './Header.css';
// Context
import AppContext from './../../context/AppContext';
@@ -21,6 +21,8 @@ class Header extends Component {
children: PropTypes.node,
t: PropTypes.func.isRequired,
userManager: PropTypes.object,
+ user: PropTypes.object,
+ modalContext: PropTypes.object,
};
static defaultProps = {
@@ -50,26 +52,29 @@ class Header extends Component {
}
loadOptions() {
- const { t } = this.props;
+ const {
+ t,
+ user,
+ userManager,
+ modalContext: { show },
+ } = this.props;
this.options = [
{
title: t('About'),
icon: { name: 'info' },
- onClick: () => {
- this.setState({
- isOpen: true,
- });
- },
+ onClick: () =>
+ show(AboutContent, {
+ title: t('OHIF Viewer - About'),
+ customClassName: 'AboutContent',
+ }),
},
];
- if (this.props.user && this.props.userManager) {
+ if (user && userManager) {
this.options.push({
title: t('Logout'),
icon: { name: 'power-off' },
- onClick: () => {
- this.props.userManager.signoutRedirect();
- },
+ onClick: () => userManager.signoutRedirect(),
});
}
@@ -85,32 +90,32 @@ class Header extends Component {
// ANTD -- Hamburger, Drawer, Menu
render() {
- const { t } = this.props;
+ const { t, home, location, children } = this.props;
const { appConfig = {} } = this.context;
const showStudyList =
appConfig.showStudyList !== undefined ? appConfig.showStudyList : true;
return (
<>
{t('INVESTIGATIONAL USE ONLY')}
-
+
- {this.props.location && this.props.location.studyLink && (
+ {location && location.studyLink && (
{t('Back to Viewer')}
)}
- {this.props.children}
+ {children}
- {showStudyList && !this.props.home && (
+ {showStudyList && !home && (
{t('Study list')}
@@ -123,16 +128,6 @@ class Header extends Component {
{t('INVESTIGATIONAL USE ONLY')}
-
- {/* TODO: We need a Modal service */}
-
- this.setState({
- isOpen: false,
- })
- }
- />
>
@@ -140,4 +135,6 @@ class Header extends Component {
}
}
-export default withTranslation('Header')(withRouter(Header));
+export default withTranslation(['Header', 'AboutModal'])(
+ withRouter(withModal(Header))
+);
diff --git a/platform/viewer/src/connectedComponents/ConnectedDownloadDialog.js b/platform/viewer/src/connectedComponents/ConnectedViewportDownloadForm.js
similarity index 95%
rename from platform/viewer/src/connectedComponents/ConnectedDownloadDialog.js
rename to platform/viewer/src/connectedComponents/ConnectedViewportDownloadForm.js
index 73d0fabc0..e0aabc7b9 100644
--- a/platform/viewer/src/connectedComponents/ConnectedDownloadDialog.js
+++ b/platform/viewer/src/connectedComponents/ConnectedViewportDownloadForm.js
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
-import { DownloadDialog } from '@ohif/ui';
+import { ViewportDownloadForm } from '@ohif/ui';
import { utils } from '@ohif/core';
import cornerstone from 'cornerstone-core';
import cornerstoneTools from 'cornerstone-tools';
@@ -14,11 +14,11 @@ const mapStateToProps = (state, ownProps) => {
viewportSpecificData[activeViewportIndex] || {};
return {
+ onClose: ownProps.hide,
minimumSize: MINIMUM_SIZE,
maximumSize: MAX_TEXTURE_SIZE,
defaultSize: DEFAULT_SIZE,
canvasClass: 'cornerstone-canvas',
- onClose: ownProps.toggleDownloadDialog,
activeViewport: activeEnabledElement,
enableViewport: viewportElement => {
if (viewportElement) {
@@ -122,9 +122,9 @@ const mapStateToProps = (state, ownProps) => {
};
};
-const ConnectedDownloadDialog = connect(
+const ConnectedViewportDownloadForm = connect(
mapStateToProps,
null
-)(DownloadDialog);
+)(ViewportDownloadForm);
-export default ConnectedDownloadDialog;
+export default ConnectedViewportDownloadForm;
diff --git a/platform/viewer/src/connectedComponents/ToolbarRow.js b/platform/viewer/src/connectedComponents/ToolbarRow.js
index faa38c6a2..fe13d3919 100644
--- a/platform/viewer/src/connectedComponents/ToolbarRow.js
+++ b/platform/viewer/src/connectedComponents/ToolbarRow.js
@@ -6,17 +6,17 @@ import {
ExpandableToolMenu,
RoundedButtonGroup,
ToolbarButton,
+ withModal,
} from '@ohif/ui';
import './ToolbarRow.css';
import { commandsManager, extensionManager } from './../App.js';
import ConnectedCineDialog from './ConnectedCineDialog';
-import ConnectedDownloadDialog from './ConnectedDownloadDialog';
+import ConnectedViewportDownloadForm from './ConnectedViewportDownloadForm';
import ConnectedLayoutButton from './ConnectedLayoutButton';
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js';
-
class ToolbarRow extends Component {
// TODO: Simplify these? isOpen can be computed if we say "any" value for selected,
// closed if selected is null/undefined
@@ -46,13 +46,10 @@ class ToolbarRow extends Component {
toolbarButtons: toolbarButtonDefinitions,
activeButtons: [],
isCineDialogOpen: false,
- isDownloadScreenShotDialogOpen: false,
};
this._handleBuiltIn = _handleBuiltIn.bind(this);
- this.toggleDownloadDialog = toggleDownloadDialog.bind(this);
-
const panelModules = extensionManager.modules[MODULE_TYPES.PANEL];
this.buttonGroups = {
left: [
@@ -116,13 +113,6 @@ class ToolbarRow extends Component {
zIndex: 999,
};
- const downloadScreenShotContainerStyle = {
- display: this.state.isDownloadScreenShotDialogOpen ? 'block' : 'none',
- position: 'absolute',
- top: '82px',
- zIndex: 1001,
- };
-
const onPress = (side, value) => {
this.props.handleSidePanelChange(side, value);
};
@@ -158,12 +148,6 @@ class ToolbarRow extends Component {
-
-
-
>
);
}
@@ -295,15 +279,6 @@ function _getVisibleToolbarButtons() {
return toolbarButtonDefinitions;
}
-/**
- * Toggles the Download Dialog Modal
- */
-function toggleDownloadDialog() {
- this.setState({
- isDownloadScreenShotDialogOpen: !this.state.isDownloadScreenShotDialogOpen,
- });
-}
-
function _handleBuiltIn({ behavior } = {}) {
if (behavior === 'CINE') {
this.setState({
@@ -312,8 +287,13 @@ function _handleBuiltIn({ behavior } = {}) {
}
if (behavior === 'DOWNLOAD_SCREEN_SHOT') {
- this.toggleDownloadDialog();
+ this.props.modalContext.show(ConnectedViewportDownloadForm, {
+ title: this.props.t('Download High Quality Image'),
+ customClassName: 'ViewportDownloadForm',
+ });
}
}
-export default withTranslation('Common')(ToolbarRow);
+export default withTranslation(['Common', 'ViewportDownloadForm'])(
+ withModal(ToolbarRow)
+);