From 5eb06d09164e33ca289b9f0a5da60dfad151b0bc Mon Sep 17 00:00:00 2001 From: dannyrb Date: Tue, 16 Jun 2020 22:06:54 -0400 Subject: [PATCH] Wire up mode buttons to mode routes; Expose displayName; --- .../default/src/ViewerLayout/Header.jsx | 15 +++++-- modes/example/src/index.js | 1 + modes/longitudinal/src/index.js | 1 + platform/ui/src/assets/icons/launch-arrow.svg | 10 ++--- .../viewer/src/routes/WorkList/WorkList.jsx | 44 ++++++++++++------- 5 files changed, 45 insertions(+), 26 deletions(-) diff --git a/extensions/default/src/ViewerLayout/Header.jsx b/extensions/default/src/ViewerLayout/Header.jsx index e4bde8383..b5f8010c0 100644 --- a/extensions/default/src/ViewerLayout/Header.jsx +++ b/extensions/default/src/ViewerLayout/Header.jsx @@ -1,9 +1,12 @@ import React from 'react'; import PropTypes from 'prop-types'; +// TODO: This may fail if package is split from PWA build +import { useHistory } from 'react-router-dom'; // import { NavBar, Svg, Icon, IconButton } from '@ohif/ui'; function Header({ children }) { + const history = useHistory(); // const dropdownContent = [ // { // name: 'Soft tissue', @@ -19,15 +22,19 @@ function Header({ children }) {
-
+ {/* // TODO: Should preserve filter/sort + // Either injected service? Or context (like react router's `useLocation`?) */} +
history.push('/')} + > alert('Navigate to previous page')} /> - +
- +
{children}
diff --git a/modes/example/src/index.js b/modes/example/src/index.js index 21c98e381..911fa112e 100644 --- a/modes/example/src/index.js +++ b/modes/example/src/index.js @@ -1,6 +1,7 @@ export default function mode({ modeConfiguration }) { return { id: 'example-mode', + displayName: 'Basic Viewer', validationTags: { study: [], series: [], diff --git a/modes/longitudinal/src/index.js b/modes/longitudinal/src/index.js index d693d26a1..9a2f14268 100644 --- a/modes/longitudinal/src/index.js +++ b/modes/longitudinal/src/index.js @@ -20,6 +20,7 @@ export default function mode({ modeConfiguration }) { // TODO: We're using this as a route segment // We should not be. id: 'longitudinal-workflow', + displayName: 'Comparison', validationTags: { study: [], series: [], diff --git a/platform/ui/src/assets/icons/launch-arrow.svg b/platform/ui/src/assets/icons/launch-arrow.svg index 58f1d6d63..da4b7827f 100644 --- a/platform/ui/src/assets/icons/launch-arrow.svg +++ b/platform/ui/src/assets/icons/launch-arrow.svg @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/platform/viewer/src/routes/WorkList/WorkList.jsx b/platform/viewer/src/routes/WorkList/WorkList.jsx index 4724ce80b..111a88633 100644 --- a/platform/viewer/src/routes/WorkList/WorkList.jsx +++ b/platform/viewer/src/routes/WorkList/WorkList.jsx @@ -310,23 +310,33 @@ function WorkList({ history, data: studies, dataSource }) { : [] } > - } - className="font-bold" - > - Comparison - - } - className="ml-4 font-bold" - > - View: Segmentation - + {appConfig.modes.map((mode, i) => { + const isFirst = i === 0; + + // TODO: Homes need a default/target route? We mostly support a single one for now. + // We should also be using the route path, but currently are not + // mode.id + // mode.routes[x].path + // Don't specify default data source, and it should just be picked up... (this may not currently be the case) + // How do we know which params to pass? Today, it's just StudyInstanceUIDs + return ( + + } // launch-arrow | launch-info + className={classnames('font-bold', { 'ml-2': !isFirst })} + > + {mode.displayName} + + + ); + })} ), onClickRow: () =>