From 0e6c9258b75be73f7162b643850101cfa0e33982 Mon Sep 17 00:00:00 2001 From: Rodrigo Antinarelli Date: Fri, 3 Jul 2020 00:58:50 -0300 Subject: [PATCH] OHIF-202: Add tooltip for locked/unlocked SR viewport icon (#1858) * OHIF-202: Add tooltip for locked/unlocked SR viewport icon * fix edit margin * Update platform/ui/src/components/ViewportActionBar/ViewportActionBar.jsx * Apply suggestions from code review * Fix tooltip (func comp) * Don't render the `0` of data.length used to check a render condition Co-authored-by: Danny Brown --- .../MeasurementTable/MeasurementTable.jsx | 51 ++++++++----------- .../ViewportActionBar/ViewportActionBar.jsx | 42 ++++++++++----- 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx b/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx index 70efc44c6..73eb38775 100644 --- a/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx +++ b/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx @@ -8,37 +8,30 @@ const MeasurementTable = ({ data, title, amount, onClick, onEdit }) => { return (
- + {title} {amount}
-
- {data.length && data.map((measurementItem, index) => ( - - ))} - {!data.length && ( -
-
-
- +
+ {data.length !== 0 && + data.map((measurementItem, index) => ( + + ))} + {data.length === 0 && ( +
+
+
+ No tracked measurements
@@ -52,8 +45,8 @@ const MeasurementTable = ({ data, title, amount, onClick, onEdit }) => { MeasurementTable.defaultProps = { amount: null, data: [], - onClick: () => { }, - onEdit: () => { }, + onClick: () => {}, + onEdit: () => {}, }; MeasurementTable.propTypes = { diff --git a/platform/ui/src/components/ViewportActionBar/ViewportActionBar.jsx b/platform/ui/src/components/ViewportActionBar/ViewportActionBar.jsx index 53455ab18..00c24ef22 100644 --- a/platform/ui/src/components/ViewportActionBar/ViewportActionBar.jsx +++ b/platform/ui/src/components/ViewportActionBar/ViewportActionBar.jsx @@ -52,22 +52,38 @@ const ViewportActionBar = ({ const renderIconStatus = () => { if (modality === 'SR') { + const TooltipMessage = isLocked + ? () => ( +
+ This SR is locked.
+ Measurements cannot be duplicated. +
+ ) + : () => ( +
+ This SR is unlocked.
+ You can duplicate measurements on your current report
by + clicking 'Edit'. +
+ ); return ( <> -
- - SR - - {isLocked && ( - - )} -
+ } position="bottom-left"> +
+ + SR + + {isLocked && ( + + )} +
+
{!isLocked && !isHydrated && ( -
+