feat: modal provider (#1151)
* feat: 🎸 New modal provider A new modal provider/context component to unify modal related code and simplify modal use Closes: #1086 * refactor(ModalContext): Keep current modal lib * Update modal provider version according to PR #1116 * Update modal provider props to use inner props * Add custom class prop * CR Update: Refactor provider to extract specific modal * Fix modal import * CR Update: Move from spread to object assign * CR Update: Add proptypes, use classnames dependency over interpolation and rename modal * fix: 🎸 Update AboutModal to use new modal provider (#1116) * feat: 🎸 Update AboutModal to use new modal provider This feature updates the AboutModal component and Header to use the new modal context (modal provider) * feat(ModalProvider): Add title prop to provider * fix(ModalContext): Add defaults on hide * CR Updates: Refactor modal provider and fix import * CR Update: Expose props and flat modal optons * Use customclassname instead of static * Add cypress tag * test: set right viewport when layout is decreased (#1146) * chore(release): publish [skip ci] - @ohif/viewer@2.3.6 * fix: 🐛 Minor issues measurement panel related to description (#1142) * chore(release): publish [skip ci] - @ohif/extension-vtk@0.52.28 - @ohif/ui@0.58.5 - @ohif/viewer@2.3.7 * fix: 🐛 Upgrade react-vtkjs-viewport to fix volume orientation (#1143) * chore(release): publish [skip ci] - @ohif/extension-vtk@0.52.29 - @ohif/viewer@2.3.8 * CR Update: Extract and rename AboutModal to AboutContent * feat: 🎸 New modal provider (#1110) * feat: 🎸 New modal provider A new modal provider/context component to unify modal related code and simplify modal use Closes: #1086 * refactor(ModalContext): Keep current modal lib * Update modal provider version according to PR #1116 * Update modal provider props to use inner props * Add custom class prop * CR Update: Refactor provider to extract specific modal * Fix modal import * CR Update: Move from spread to object assign * CR Update: Add proptypes, use classnames dependency over interpolation and rename modal * chore(release): publish [skip ci] - @ohif/extension-vtk@0.52.30 - @ohif/ui@0.59.0 - @ohif/viewer@2.4.0 * CR Update: Keep translation name * CR Update: Reposition cy tag of about modal in the correct level * feat: 🎸 Update DownloadModal to use new modal provider (#1119) * feat: 🎸 Update AboutModal to use new modal provider This feature updates the AboutModal component and Header to use the new modal context (modal provider) * feat(ModalProvider): Add title prop to provider * feat(DownloadModal): Refactor to use new modal provider * Update modal provider props * Use translation for DownloadDialog * CR Update: Use useTranslation hook * CR Update: Extract downloadDialog and rename to downloadContent * CR Update: Fix typo * CR Update: Rename download content to viewport download form
This commit is contained in:
parent
9827d1bf84
commit
75d88bc454
@ -17,8 +17,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## [0.52.30](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.29...@ohif/extension-vtk@0.52.30) (2019-11-04)
|
## [0.52.30](https://github.com/OHIF/Viewers/compare/@ohif/extension-vtk@0.52.29...@ohif/extension-vtk@0.52.30) (2019-11-04)
|
||||||
|
|
||||||
**Note:** Version bump only for package @ohif/extension-vtk
|
**Note:** Version bump only for package @ohif/extension-vtk
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
import AboutModal from "./AboutModal.json";
|
import AboutModal from './AboutModal.json';
|
||||||
import Buttons from "./Buttons.json";
|
import Buttons from './Buttons.json';
|
||||||
import CineDialog from "./CineDialog.json";
|
import CineDialog from './CineDialog.json';
|
||||||
import Common from "./Common.json";
|
import Common from './Common.json';
|
||||||
import Header from "./Header.json";
|
import Header from './Header.json';
|
||||||
import MeasurementTable from "./MeasurementTable.json";
|
import MeasurementTable from './MeasurementTable.json';
|
||||||
import StudyList from "./StudyList.json";
|
import StudyList from './StudyList.json';
|
||||||
import UserPreferencesModal from "./UserPreferencesModal.json";
|
import UserPreferencesModal from './UserPreferencesModal.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'en-US': {
|
'en-US': {
|
||||||
@ -17,5 +17,5 @@ export default {
|
|||||||
MeasurementTable,
|
MeasurementTable,
|
||||||
StudyList,
|
StudyList,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import AboutModal from "./AboutModal.json";
|
import AboutModal from './AboutModal.json';
|
||||||
import Buttons from "./Buttons.json";
|
import Buttons from './Buttons.json';
|
||||||
import CineDialog from "./CineDialog.json";
|
import CineDialog from './CineDialog.json';
|
||||||
import Common from "./Common.json";
|
import Common from './Common.json';
|
||||||
import Header from "./Header.json";
|
import Header from './Header.json';
|
||||||
import UserPreferencesModal from "./UserPreferencesModal.json";
|
import UserPreferencesModal from './UserPreferencesModal.json';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
'pt-BR': {
|
'pt-BR': {
|
||||||
@ -13,5 +13,5 @@ export default {
|
|||||||
Common,
|
Common,
|
||||||
Header,
|
Header,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
@ -3,6 +3,7 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||||
|
|
||||||
|
|
||||||
## [0.59.1](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.59.0...@ohif/ui@0.59.1) (2019-11-05)
|
## [0.59.1](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.59.0...@ohif/ui@0.59.1) (2019-11-05)
|
||||||
|
|
||||||
|
|
||||||
@ -13,7 +14,6 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# [0.59.0](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.58.5...@ohif/ui@0.59.0) (2019-11-04)
|
# [0.59.0](https://github.com/OHIF/Viewers/compare/@ohif/ui@0.58.5...@ohif/ui@0.59.0) (2019-11-04)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
107
platform/ui/src/components/content/aboutContent/AboutContent.js
Normal file
107
platform/ui/src/components/content/aboutContent/AboutContent.js
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import detect from 'browser-detect';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
import './AboutContent.styl';
|
||||||
|
|
||||||
|
const AboutContent = () => {
|
||||||
|
const { t } = useTranslation('AboutContent');
|
||||||
|
|
||||||
|
const { os, version, name } = detect();
|
||||||
|
const capitalize = s =>
|
||||||
|
s.substr(0, 1).toUpperCase() + s.substr(1).toLowerCase();
|
||||||
|
|
||||||
|
const itemsPreset = () => {
|
||||||
|
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(name)} ${version}`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t('OS'),
|
||||||
|
value: os,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
const renderTableRow = ({ name, value, link }) => (
|
||||||
|
<tr key={name} style={{ backgroundColor: 'transparent' }}>
|
||||||
|
<td>{name}</td>
|
||||||
|
<td>
|
||||||
|
{link ? (
|
||||||
|
<a target="_blank" rel="noopener noreferrer" href={link}>
|
||||||
|
{value}
|
||||||
|
</a>
|
||||||
|
) : (
|
||||||
|
value
|
||||||
|
)}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div data-cy="about-modal">
|
||||||
|
<div className="btn-group">
|
||||||
|
<a
|
||||||
|
className="btn btn-default"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
href="https://groups.google.com/forum/#!forum/cornerstone-platform"
|
||||||
|
>
|
||||||
|
{t('Visit the forum')}
|
||||||
|
</a>
|
||||||
|
{` `}
|
||||||
|
<a
|
||||||
|
className="btn btn-default"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
href="https://github.com/OHIF/Viewers/issues/new/choose"
|
||||||
|
>
|
||||||
|
{t('Report an issue')}
|
||||||
|
</a>
|
||||||
|
{` `}
|
||||||
|
<a
|
||||||
|
className="btn btn-default"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
href="http://ohif.org"
|
||||||
|
>
|
||||||
|
{t('More details')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<h3>{t('Version Information')}</h3>
|
||||||
|
<table className="table table-responsive">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{t('Name')}</th>
|
||||||
|
<th>{t('Value')}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>{itemsPreset().map(item => renderTableRow(item))}</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export { AboutContent };
|
||||||
|
export default AboutContent;
|
||||||
@ -1,7 +1,7 @@
|
|||||||
@import './../../design/styles/common/button.styl'
|
@import '../../../design/styles/common/button.styl'
|
||||||
@import './../../design/styles/common/table.styl'
|
@import '../../../design/styles/common/table.styl'
|
||||||
|
|
||||||
.AboutModal
|
.AboutContent
|
||||||
.btn
|
.btn
|
||||||
border-color: #ccc;
|
border-color: #ccc;
|
||||||
|
|
||||||
@ -1,10 +1,9 @@
|
|||||||
import React, { useEffect, useState, createRef } from 'react';
|
import React, { useEffect, useState, createRef } from 'react';
|
||||||
import Modal from 'react-bootstrap-modal';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import './DownloadDialog.styl';
|
import './ViewportDownloadForm.styl';
|
||||||
import { TextInput, Select } from '@ohif/ui';
|
import { TextInput, Select } from '@ohif/ui';
|
||||||
import { withTranslation } from '../../utils/LanguageProvider';
|
|
||||||
|
|
||||||
const FILE_TYPE_OPTIONS = [
|
const FILE_TYPE_OPTIONS = [
|
||||||
{
|
{
|
||||||
@ -19,9 +18,7 @@ const FILE_TYPE_OPTIONS = [
|
|||||||
|
|
||||||
const DEFAULT_FILENAME = 'image';
|
const DEFAULT_FILENAME = 'image';
|
||||||
|
|
||||||
const DownloadDialog = ({
|
const ViewportDownloadForm = ({
|
||||||
t,
|
|
||||||
isOpen,
|
|
||||||
activeViewport,
|
activeViewport,
|
||||||
onClose,
|
onClose,
|
||||||
updateViewportPreview,
|
updateViewportPreview,
|
||||||
@ -35,6 +32,8 @@ const DownloadDialog = ({
|
|||||||
maximumSize,
|
maximumSize,
|
||||||
canvasClass,
|
canvasClass,
|
||||||
}) => {
|
}) => {
|
||||||
|
const [t] = useTranslation('ViewportDownloadForm');
|
||||||
|
|
||||||
const [filename, setFilename] = useState(DEFAULT_FILENAME);
|
const [filename, setFilename] = useState(DEFAULT_FILENAME);
|
||||||
const [fileType, setFileType] = useState('jpg');
|
const [fileType, setFileType] = useState('jpg');
|
||||||
|
|
||||||
@ -190,19 +189,7 @@ const DownloadDialog = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<>
|
||||||
show={isOpen}
|
|
||||||
onHide={onClose}
|
|
||||||
aria-labelledby="ModalHeader"
|
|
||||||
className="DownloadDialog modal fade themed in"
|
|
||||||
backdrop={false}
|
|
||||||
large={true}
|
|
||||||
keyboard={true}
|
|
||||||
>
|
|
||||||
<Modal.Header closeButton>
|
|
||||||
<Modal.Title>{t('Download High Quality Image')}</Modal.Title>
|
|
||||||
</Modal.Header>
|
|
||||||
<Modal.Body>
|
|
||||||
<div className="title">
|
<div className="title">
|
||||||
{t(
|
{t(
|
||||||
'Please specify the dimensions, filename, and desired type for the output image.'
|
'Please specify the dimensions, filename, and desired type for the output image.'
|
||||||
@ -316,16 +303,13 @@ const DownloadDialog = ({
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Modal.Body>
|
</>
|
||||||
</Modal>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
DownloadDialog.propTypes = {
|
ViewportDownloadForm.propTypes = {
|
||||||
t: PropTypes.func.isRequired,
|
|
||||||
isOpen: PropTypes.bool.isRequired,
|
|
||||||
activeViewport: PropTypes.object,
|
|
||||||
onClose: PropTypes.func.isRequired,
|
onClose: PropTypes.func.isRequired,
|
||||||
|
activeViewport: PropTypes.object,
|
||||||
updateViewportPreview: PropTypes.func.isRequired,
|
updateViewportPreview: PropTypes.func.isRequired,
|
||||||
enableViewport: PropTypes.func.isRequired,
|
enableViewport: PropTypes.func.isRequired,
|
||||||
disableViewport: PropTypes.func.isRequired,
|
disableViewport: PropTypes.func.isRequired,
|
||||||
@ -338,4 +322,4 @@ DownloadDialog.propTypes = {
|
|||||||
canvasClass: PropTypes.string.isRequired,
|
canvasClass: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default withTranslation('DownloadDialog')(DownloadDialog);
|
export default ViewportDownloadForm;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
@import './../../design/styles/common/global.styl'
|
@import '../../../design/styles/common/global.styl'
|
||||||
@import './../../design/styles/common/form.styl'
|
@import '../../../design/styles/common/form.styl'
|
||||||
@import './../../design/styles/common/button.styl'
|
@import '../../../design/styles/common/button.styl'
|
||||||
|
|
||||||
.DownloadDialog
|
.ViewportDownloadForm
|
||||||
color: var(--text-secondary-color);
|
color: var(--text-secondary-color);
|
||||||
filter: drop-shadow(0 0 3px var(--ui-gray-darkest));
|
filter: drop-shadow(0 0 3px var(--ui-gray-darkest));
|
||||||
border: none;
|
border: none;
|
||||||
@ -1,15 +1,15 @@
|
|||||||
---
|
---
|
||||||
name: Download Dialog
|
name: Viewport Download Form
|
||||||
menu: Components
|
menu: Components
|
||||||
route: /components/download-dialog
|
route: /components/viewport-download-form
|
||||||
---
|
---
|
||||||
|
|
||||||
import { Playground, Props } from 'docz'
|
import { Playground, Props } from 'docz'
|
||||||
import { State } from 'react-powerplug'
|
import { State } from 'react-powerplug'
|
||||||
import { DownloadDialog } from './../index'
|
import { ViewportDownloadForm } from './../index'
|
||||||
import NameSpace from '../../../__docs__/NameSpace'
|
import NameSpace from '../../../__docs__/NameSpace'
|
||||||
|
|
||||||
# Download Dialog
|
# Viewport Download Form
|
||||||
|
|
||||||
## Basic usage
|
## Basic usage
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ import NameSpace from '../../../__docs__/NameSpace'
|
|||||||
<pre>{JSON.stringify(state, null, 2)}</pre>
|
<pre>{JSON.stringify(state, null, 2)}</pre>
|
||||||
</div>
|
</div>
|
||||||
<div style={{ maxWidth: '400px', margin: '0 auto' }}>
|
<div style={{ maxWidth: '400px', margin: '0 auto' }}>
|
||||||
<DownloadDialog />
|
<ViewportDownloadForm />
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
@ -32,8 +32,8 @@ import NameSpace from '../../../__docs__/NameSpace'
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
<Props of={DownloadDialog} />
|
<Props of={ViewportDownloadForm} />
|
||||||
|
|
||||||
## Translation Namespace
|
## Translation Namespace
|
||||||
|
|
||||||
<NameSpace name="DownloadDialog" />
|
<NameSpace name="ViewportDownloadForm" />
|
||||||
@ -0,0 +1,2 @@
|
|||||||
|
import ViewportDownloadForm from './ViewportDownloadForm';
|
||||||
|
export { ViewportDownloadForm };
|
||||||
@ -1,2 +0,0 @@
|
|||||||
import DownloadDialog from './DownloadDialog';
|
|
||||||
export { DownloadDialog };
|
|
||||||
@ -4,14 +4,14 @@ import { MeasurementTable, MeasurementTableItem } from './measurementTable';
|
|||||||
import { Overlay, OverlayTrigger } from './overlayTrigger';
|
import { Overlay, OverlayTrigger } from './overlayTrigger';
|
||||||
import { TableList, TableListItem } from './tableList';
|
import { TableList, TableListItem } from './tableList';
|
||||||
import {
|
import {
|
||||||
AboutModal,
|
AboutContent,
|
||||||
UserPreferences,
|
UserPreferences,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
} from './userPreferencesModal';
|
} from './userPreferencesModal';
|
||||||
|
|
||||||
import { Checkbox } from './checkbox';
|
import { Checkbox } from './checkbox';
|
||||||
import { CineDialog } from './cineDialog';
|
import { CineDialog } from './cineDialog';
|
||||||
import { DownloadDialog } from './downloadDialog';
|
import { ViewportDownloadForm } from './content/viewportDownloadForm';
|
||||||
import { QuickSwitch } from './quickSwitch';
|
import { QuickSwitch } from './quickSwitch';
|
||||||
import { RoundedButtonGroup } from './roundedButtonGroup';
|
import { RoundedButtonGroup } from './roundedButtonGroup';
|
||||||
import { SelectTree } from './selectTree';
|
import { SelectTree } from './selectTree';
|
||||||
@ -29,7 +29,7 @@ import { Tooltip } from './tooltip';
|
|||||||
export {
|
export {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CineDialog,
|
CineDialog,
|
||||||
DownloadDialog,
|
ViewportDownloadForm,
|
||||||
LayoutButton,
|
LayoutButton,
|
||||||
LayoutChooser,
|
LayoutChooser,
|
||||||
MeasurementTable,
|
MeasurementTable,
|
||||||
@ -50,7 +50,7 @@ export {
|
|||||||
TablePagination,
|
TablePagination,
|
||||||
ToolbarSection,
|
ToolbarSection,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
AboutModal,
|
AboutContent,
|
||||||
UserPreferences,
|
UserPreferences,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
OHIFModal,
|
OHIFModal,
|
||||||
|
|||||||
@ -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 (
|
|
||||||
<tr key={item.name} style={{ backgroundColor: 'transparent' }}>
|
|
||||||
<td>{item.name}</td>
|
|
||||||
<td>
|
|
||||||
{item.link ? (
|
|
||||||
<a target="_blank" href={item.link}>
|
|
||||||
{item.value}
|
|
||||||
</a>
|
|
||||||
) : (
|
|
||||||
item.value
|
|
||||||
)}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
|
||||||
const { t } = this.props;
|
|
||||||
return (
|
|
||||||
<Modal
|
|
||||||
show={this.props.isOpen}
|
|
||||||
onHide={this.props.onCancel}
|
|
||||||
aria-labelledby="ModalHeader"
|
|
||||||
className="AboutModal modal fade themed in"
|
|
||||||
backdrop={false}
|
|
||||||
large={true}
|
|
||||||
keyboard={false}
|
|
||||||
>
|
|
||||||
<Modal.Header closeButton>
|
|
||||||
<Modal.Title>{t('OHIF Viewer - About')}</Modal.Title>
|
|
||||||
</Modal.Header>
|
|
||||||
<Modal.Body data-cy="about-modal">
|
|
||||||
<div className="btn-group">
|
|
||||||
<a
|
|
||||||
className="btn btn-default"
|
|
||||||
target="_blank"
|
|
||||||
href="https://groups.google.com/forum/#!forum/cornerstone-platform"
|
|
||||||
>
|
|
||||||
{t('Visit the forum')}
|
|
||||||
</a>
|
|
||||||
{` `}
|
|
||||||
<a
|
|
||||||
className="btn btn-default"
|
|
||||||
target="_blank"
|
|
||||||
href="https://github.com/OHIF/Viewers/issues/new/choose"
|
|
||||||
>
|
|
||||||
{t('Report an issue')}
|
|
||||||
</a>
|
|
||||||
{` `}
|
|
||||||
<a
|
|
||||||
className="btn btn-default"
|
|
||||||
target="_blank"
|
|
||||||
href="http://ohif.org"
|
|
||||||
>
|
|
||||||
{t('More details')}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3>{t('Version Information')}</h3>
|
|
||||||
<table className="table table-responsive">
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>{t('Name')}</th>
|
|
||||||
<th>{t('Value')}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
{this.itemsPreset().map(item => this.renderTableRow(item))}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</Modal.Body>
|
|
||||||
</Modal>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const connectedComponent = withTranslation('AboutModal')(AboutModal);
|
|
||||||
export { connectedComponent as AboutModal };
|
|
||||||
export default connectedComponent;
|
|
||||||
@ -6,7 +6,7 @@ route: /components/about-modal
|
|||||||
|
|
||||||
import { Playground, Props } from 'docz'
|
import { Playground, Props } from 'docz'
|
||||||
import { State } from 'react-powerplug'
|
import { State } from 'react-powerplug'
|
||||||
import { AboutModal } from './../index.js'
|
import { AboutContent } from './../index.js'
|
||||||
|
|
||||||
# About Modal
|
# About Modal
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ import { AboutModal } from './../index.js'
|
|||||||
>
|
>
|
||||||
Open about modal
|
Open about modal
|
||||||
</button>
|
</button>
|
||||||
<AboutModal
|
<AboutContent
|
||||||
{...state}
|
{...state}
|
||||||
onCancel={() => setState({ isOpen: false })}
|
onCancel={() => setState({ isOpen: false })}
|
||||||
/>
|
/>
|
||||||
@ -39,4 +39,4 @@ import { AboutModal } from './../index.js'
|
|||||||
|
|
||||||
## API
|
## API
|
||||||
|
|
||||||
<Props of={AboutModal} />
|
<Props of={AboutContent} />
|
||||||
|
|||||||
@ -60,11 +60,6 @@ export default {
|
|||||||
keys: [''],
|
keys: [''],
|
||||||
column: 1,
|
column: 1,
|
||||||
},
|
},
|
||||||
toggleDownloadDialog: {
|
|
||||||
label: 'Show/Hide Download Dialog',
|
|
||||||
keys: [''],
|
|
||||||
column: 1,
|
|
||||||
},
|
|
||||||
|
|
||||||
// Preset hotkeys
|
// Preset hotkeys
|
||||||
WLPreset0: { label: 'W/L Preset 0 (Soft Tissue)', keys: ['1'], column: 1 },
|
WLPreset0: { label: 'W/L Preset 0 (Soft Tissue)', keys: ['1'], column: 1 },
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export { UserPreferences } from './UserPreferences.js';
|
export { UserPreferences } from './UserPreferences.js';
|
||||||
export { AboutModal } from './AboutModal.js';
|
export { AboutContent } from '../content/aboutContent/AboutContent.js';
|
||||||
export { UserPreferencesModal } from './UserPreferencesModal.js';
|
export { UserPreferencesModal } from './UserPreferencesModal.js';
|
||||||
export { GeneralPreferences } from './GeneralPreferences.js';
|
export { GeneralPreferences } from './GeneralPreferences.js';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
Checkbox,
|
Checkbox,
|
||||||
CineDialog,
|
CineDialog,
|
||||||
DownloadDialog,
|
ViewportDownloadForm,
|
||||||
LayoutButton,
|
LayoutButton,
|
||||||
LayoutChooser,
|
LayoutChooser,
|
||||||
MeasurementTable,
|
MeasurementTable,
|
||||||
@ -22,7 +22,7 @@ import {
|
|||||||
TablePagination,
|
TablePagination,
|
||||||
ToolbarSection,
|
ToolbarSection,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
AboutModal,
|
AboutContent,
|
||||||
UserPreferences,
|
UserPreferences,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
OHIFModal,
|
OHIFModal,
|
||||||
@ -69,7 +69,7 @@ export {
|
|||||||
TextArea,
|
TextArea,
|
||||||
TextInput,
|
TextInput,
|
||||||
CineDialog,
|
CineDialog,
|
||||||
DownloadDialog,
|
ViewportDownloadForm,
|
||||||
ExpandableToolMenu,
|
ExpandableToolMenu,
|
||||||
Icon,
|
Icon,
|
||||||
LayoutButton,
|
LayoutButton,
|
||||||
@ -99,7 +99,7 @@ export {
|
|||||||
ToolbarButton,
|
ToolbarButton,
|
||||||
ToolbarSection,
|
ToolbarSection,
|
||||||
Tooltip,
|
Tooltip,
|
||||||
AboutModal,
|
AboutContent,
|
||||||
UserPreferences,
|
UserPreferences,
|
||||||
UserPreferencesModal,
|
UserPreferencesModal,
|
||||||
ViewerbaseDragDropContext,
|
ViewerbaseDragDropContext,
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
# [2.5.0](https://github.com/OHIF/Viewers/compare/@ohif/viewer@2.4.1...@ohif/viewer@2.5.0) (2019-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import './Header.css';
|
|
||||||
|
|
||||||
import { Link, withRouter } from 'react-router-dom';
|
|
||||||
import React, { Component } from 'react';
|
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 { Dropdown } from '@ohif/ui';
|
||||||
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
import { AboutContent } from '@ohif/ui';
|
||||||
import PropTypes from 'prop-types';
|
import { withModal } from '@ohif/ui';
|
||||||
import { AboutModal } from '@ohif/ui';
|
|
||||||
import { hotkeysManager } from './../../App.js';
|
|
||||||
import { withTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
|
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
||||||
|
import { hotkeysManager } from './../../App.js';
|
||||||
|
import './Header.css';
|
||||||
// Context
|
// Context
|
||||||
import AppContext from './../../context/AppContext';
|
import AppContext from './../../context/AppContext';
|
||||||
|
|
||||||
@ -21,6 +21,8 @@ class Header extends Component {
|
|||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
userManager: PropTypes.object,
|
userManager: PropTypes.object,
|
||||||
|
user: PropTypes.object,
|
||||||
|
modalContext: PropTypes.object,
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
@ -50,26 +52,29 @@ class Header extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loadOptions() {
|
loadOptions() {
|
||||||
const { t } = this.props;
|
const {
|
||||||
|
t,
|
||||||
|
user,
|
||||||
|
userManager,
|
||||||
|
modalContext: { show },
|
||||||
|
} = this.props;
|
||||||
this.options = [
|
this.options = [
|
||||||
{
|
{
|
||||||
title: t('About'),
|
title: t('About'),
|
||||||
icon: { name: 'info' },
|
icon: { name: 'info' },
|
||||||
onClick: () => {
|
onClick: () =>
|
||||||
this.setState({
|
show(AboutContent, {
|
||||||
isOpen: true,
|
title: t('OHIF Viewer - About'),
|
||||||
});
|
customClassName: 'AboutContent',
|
||||||
},
|
}),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (this.props.user && this.props.userManager) {
|
if (user && userManager) {
|
||||||
this.options.push({
|
this.options.push({
|
||||||
title: t('Logout'),
|
title: t('Logout'),
|
||||||
icon: { name: 'power-off' },
|
icon: { name: 'power-off' },
|
||||||
onClick: () => {
|
onClick: () => userManager.signoutRedirect(),
|
||||||
this.props.userManager.signoutRedirect();
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,32 +90,32 @@ class Header extends Component {
|
|||||||
|
|
||||||
// ANTD -- Hamburger, Drawer, Menu
|
// ANTD -- Hamburger, Drawer, Menu
|
||||||
render() {
|
render() {
|
||||||
const { t } = this.props;
|
const { t, home, location, children } = this.props;
|
||||||
const { appConfig = {} } = this.context;
|
const { appConfig = {} } = this.context;
|
||||||
const showStudyList =
|
const showStudyList =
|
||||||
appConfig.showStudyList !== undefined ? appConfig.showStudyList : true;
|
appConfig.showStudyList !== undefined ? appConfig.showStudyList : true;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="notification-bar">{t('INVESTIGATIONAL USE ONLY')}</div>
|
<div className="notification-bar">{t('INVESTIGATIONAL USE ONLY')}</div>
|
||||||
<div className={`entry-header ${this.props.home ? 'header-big' : ''}`}>
|
<div className={`entry-header ${home ? 'header-big' : ''}`}>
|
||||||
<div className="header-left-box">
|
<div className="header-left-box">
|
||||||
{this.props.location && this.props.location.studyLink && (
|
{location && location.studyLink && (
|
||||||
<Link
|
<Link
|
||||||
to={this.props.location.studyLink}
|
to={location.studyLink}
|
||||||
className="header-btn header-viewerLink"
|
className="header-btn header-viewerLink"
|
||||||
>
|
>
|
||||||
{t('Back to Viewer')}
|
{t('Back to Viewer')}
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{this.props.children}
|
{children}
|
||||||
|
|
||||||
{showStudyList && !this.props.home && (
|
{showStudyList && !home && (
|
||||||
<Link
|
<Link
|
||||||
className="header-btn header-studyListLinkSection"
|
className="header-btn header-studyListLinkSection"
|
||||||
to={{
|
to={{
|
||||||
pathname: '/',
|
pathname: '/',
|
||||||
state: { studyLink: this.props.location.pathname },
|
state: { studyLink: location.pathname },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Study list')}
|
{t('Study list')}
|
||||||
@ -123,16 +128,6 @@ class Header extends Component {
|
|||||||
{t('INVESTIGATIONAL USE ONLY')}
|
{t('INVESTIGATIONAL USE ONLY')}
|
||||||
</span>
|
</span>
|
||||||
<Dropdown title={t('Options')} list={this.options} align="right" />
|
<Dropdown title={t('Options')} list={this.options} align="right" />
|
||||||
|
|
||||||
{/* TODO: We need a Modal service */}
|
|
||||||
<AboutModal
|
|
||||||
{...this.state}
|
|
||||||
onCancel={() =>
|
|
||||||
this.setState({
|
|
||||||
isOpen: false,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@ -140,4 +135,6 @@ class Header extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTranslation('Header')(withRouter(Header));
|
export default withTranslation(['Header', 'AboutModal'])(
|
||||||
|
withRouter(withModal(Header))
|
||||||
|
);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { DownloadDialog } from '@ohif/ui';
|
import { ViewportDownloadForm } from '@ohif/ui';
|
||||||
import { utils } from '@ohif/core';
|
import { utils } from '@ohif/core';
|
||||||
import cornerstone from 'cornerstone-core';
|
import cornerstone from 'cornerstone-core';
|
||||||
import cornerstoneTools from 'cornerstone-tools';
|
import cornerstoneTools from 'cornerstone-tools';
|
||||||
@ -14,11 +14,11 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
viewportSpecificData[activeViewportIndex] || {};
|
viewportSpecificData[activeViewportIndex] || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
onClose: ownProps.hide,
|
||||||
minimumSize: MINIMUM_SIZE,
|
minimumSize: MINIMUM_SIZE,
|
||||||
maximumSize: MAX_TEXTURE_SIZE,
|
maximumSize: MAX_TEXTURE_SIZE,
|
||||||
defaultSize: DEFAULT_SIZE,
|
defaultSize: DEFAULT_SIZE,
|
||||||
canvasClass: 'cornerstone-canvas',
|
canvasClass: 'cornerstone-canvas',
|
||||||
onClose: ownProps.toggleDownloadDialog,
|
|
||||||
activeViewport: activeEnabledElement,
|
activeViewport: activeEnabledElement,
|
||||||
enableViewport: viewportElement => {
|
enableViewport: viewportElement => {
|
||||||
if (viewportElement) {
|
if (viewportElement) {
|
||||||
@ -122,9 +122,9 @@ const mapStateToProps = (state, ownProps) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const ConnectedDownloadDialog = connect(
|
const ConnectedViewportDownloadForm = connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
null
|
null
|
||||||
)(DownloadDialog);
|
)(ViewportDownloadForm);
|
||||||
|
|
||||||
export default ConnectedDownloadDialog;
|
export default ConnectedViewportDownloadForm;
|
||||||
@ -6,17 +6,17 @@ import {
|
|||||||
ExpandableToolMenu,
|
ExpandableToolMenu,
|
||||||
RoundedButtonGroup,
|
RoundedButtonGroup,
|
||||||
ToolbarButton,
|
ToolbarButton,
|
||||||
|
withModal,
|
||||||
} from '@ohif/ui';
|
} from '@ohif/ui';
|
||||||
|
|
||||||
import './ToolbarRow.css';
|
import './ToolbarRow.css';
|
||||||
import { commandsManager, extensionManager } from './../App.js';
|
import { commandsManager, extensionManager } from './../App.js';
|
||||||
|
|
||||||
import ConnectedCineDialog from './ConnectedCineDialog';
|
import ConnectedCineDialog from './ConnectedCineDialog';
|
||||||
import ConnectedDownloadDialog from './ConnectedDownloadDialog';
|
import ConnectedViewportDownloadForm from './ConnectedViewportDownloadForm';
|
||||||
import ConnectedLayoutButton from './ConnectedLayoutButton';
|
import ConnectedLayoutButton from './ConnectedLayoutButton';
|
||||||
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js';
|
import ConnectedPluginSwitch from './ConnectedPluginSwitch.js';
|
||||||
|
|
||||||
|
|
||||||
class ToolbarRow extends Component {
|
class ToolbarRow extends Component {
|
||||||
// TODO: Simplify these? isOpen can be computed if we say "any" value for selected,
|
// TODO: Simplify these? isOpen can be computed if we say "any" value for selected,
|
||||||
// closed if selected is null/undefined
|
// closed if selected is null/undefined
|
||||||
@ -46,13 +46,10 @@ class ToolbarRow extends Component {
|
|||||||
toolbarButtons: toolbarButtonDefinitions,
|
toolbarButtons: toolbarButtonDefinitions,
|
||||||
activeButtons: [],
|
activeButtons: [],
|
||||||
isCineDialogOpen: false,
|
isCineDialogOpen: false,
|
||||||
isDownloadScreenShotDialogOpen: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this._handleBuiltIn = _handleBuiltIn.bind(this);
|
this._handleBuiltIn = _handleBuiltIn.bind(this);
|
||||||
|
|
||||||
this.toggleDownloadDialog = toggleDownloadDialog.bind(this);
|
|
||||||
|
|
||||||
const panelModules = extensionManager.modules[MODULE_TYPES.PANEL];
|
const panelModules = extensionManager.modules[MODULE_TYPES.PANEL];
|
||||||
this.buttonGroups = {
|
this.buttonGroups = {
|
||||||
left: [
|
left: [
|
||||||
@ -116,13 +113,6 @@ class ToolbarRow extends Component {
|
|||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
};
|
};
|
||||||
|
|
||||||
const downloadScreenShotContainerStyle = {
|
|
||||||
display: this.state.isDownloadScreenShotDialogOpen ? 'block' : 'none',
|
|
||||||
position: 'absolute',
|
|
||||||
top: '82px',
|
|
||||||
zIndex: 1001,
|
|
||||||
};
|
|
||||||
|
|
||||||
const onPress = (side, value) => {
|
const onPress = (side, value) => {
|
||||||
this.props.handleSidePanelChange(side, value);
|
this.props.handleSidePanelChange(side, value);
|
||||||
};
|
};
|
||||||
@ -158,12 +148,6 @@ class ToolbarRow extends Component {
|
|||||||
<div className="CineDialogContainer" style={cineDialogContainerStyle}>
|
<div className="CineDialogContainer" style={cineDialogContainerStyle}>
|
||||||
<ConnectedCineDialog />
|
<ConnectedCineDialog />
|
||||||
</div>
|
</div>
|
||||||
<div className="DownloadScreenShotContainer" style={downloadScreenShotContainerStyle}>
|
|
||||||
<ConnectedDownloadDialog
|
|
||||||
isOpen={this.state.isDownloadScreenShotDialogOpen}
|
|
||||||
toggleDownloadDialog={this.toggleDownloadDialog}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -295,15 +279,6 @@ function _getVisibleToolbarButtons() {
|
|||||||
return toolbarButtonDefinitions;
|
return toolbarButtonDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Toggles the Download Dialog Modal
|
|
||||||
*/
|
|
||||||
function toggleDownloadDialog() {
|
|
||||||
this.setState({
|
|
||||||
isDownloadScreenShotDialogOpen: !this.state.isDownloadScreenShotDialogOpen,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function _handleBuiltIn({ behavior } = {}) {
|
function _handleBuiltIn({ behavior } = {}) {
|
||||||
if (behavior === 'CINE') {
|
if (behavior === 'CINE') {
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -312,8 +287,13 @@ function _handleBuiltIn({ behavior } = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (behavior === 'DOWNLOAD_SCREEN_SHOT') {
|
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)
|
||||||
|
);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user