From 11e58e70f673a12c4dbd678cca61efa06332ece3 Mon Sep 17 00:00:00 2001 From: Gustavo Lelis Date: Thu, 23 Apr 2020 19:23:37 -0300 Subject: [PATCH] Implement tooltip on remaining paces --- .../MeasurementTable/MeasurementTable.jsx | 2 + .../SegmentationTable/SegmentationTable.jsx | 22 +++-- .../ThumbnailTracked/ThumbnailTracked.jsx | 66 +++++-------- .../ui/src/components/Tooltip/Tooltip.jsx | 30 +++--- .../ViewportActionBar/ViewportActionBar.jsx | 97 ++++++++----------- .../components/ViewportGrid/ViewportGrid.jsx | 2 +- 6 files changed, 100 insertions(+), 119 deletions(-) diff --git a/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx b/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx index 2f620780f..8afcd8291 100644 --- a/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx +++ b/platform/ui/src/components/MeasurementTable/MeasurementTable.jsx @@ -28,6 +28,7 @@ const MeasurementTable = ({ data, title, amount, onClick, onEdit }) => { onClick={() => onClick(measurementItem.id)} onKeyDown={() => onClick(measurementItem.id)} role="button" + tabIndex="0" >
{ right: 4, transform: isActive ? '' : 'translateX(100%)', }} + e onClick={(e) => { // stopPropagation needed to avoid disable the current active item e.stopPropagation(); diff --git a/platform/ui/src/components/SegmentationTable/SegmentationTable.jsx b/platform/ui/src/components/SegmentationTable/SegmentationTable.jsx index 743aa210f..fd1cbb4ea 100644 --- a/platform/ui/src/components/SegmentationTable/SegmentationTable.jsx +++ b/platform/ui/src/components/SegmentationTable/SegmentationTable.jsx @@ -43,6 +43,16 @@ const SegmentationTable = ({ title, amount, data }) => { const itemKey = i; const currentItem = i + 1; const isActive = !!activeItem && activeItem[title] === i; + + const handleOnClick = () => { + setActiveItem((s) => { + return { + ...s, + [title]: s && s[title] === itemKey ? null : itemKey, + }; + }); + }; + return (
{ 'border-primary-light': isActive, } )} - onClick={() => { - setActiveItem((s) => { - return { - ...s, - [title]: s && s[title] === itemKey ? null : itemKey, - }; - }); - }} + onClick={handleOnClick} + onKeyDown={handleOnClick} + role="button" + tabIndex="0" >
- -
- {viewportIdentificator} -
-
-
-
- - Series is tracked - - {viewportIdentificator && ( + +
- in viewport - - {viewportIdentificator} - + Series is tracked - )} -
-
- + {viewportIdentificator && ( + + in viewport + + {viewportIdentificator} + + + )} +
+
+ +
+ } + > + +
+ {viewportIdentificator}
- - - -
+
{isTracked && ( { const [isActive, setIsActive] = useState(false); + + const handleMouseOver = () => { + if (!isActive) { + setIsActive(true); + } + }; + + const handleMouseOut = () => { + if (isActive) { + setIsActive(false); + } + }; + return (
{ - if (!isActive) { - setIsActive(true); - } - }} - onMouseOut={() => { - if (isActive) { - setIsActive(false); - } - }} + className="relative " + onMouseOver={handleMouseOver} + onFocus={handleMouseOver} + onMouseOut={handleMouseOut} + onBlur={handleMouseOut} + role="tooltip" > {children}
{ } return ( -
- - {isTracked && ( -
+ {!isTracked ? ( + + ) : ( + +
+ +
+
+ + Series is + tracked and + can be viewed
in the measurement panel +
+
+
+ } > -
-
- -
-
- - Series is - tracked and can - be viewed
in the measurement panel -
-
-
- - - -
+ + )}
); @@ -129,20 +118,9 @@ const ViewportActionBar = ({ studyData, onSeriesChange }) => {
-
-
- - -
-
+
@@ -197,18 +175,19 @@ const ViewportActionBar = ({ studyData, onSeriesChange }) => {
- - - + } + > +
+
+ + +
-
+
); diff --git a/platform/ui/src/components/ViewportGrid/ViewportGrid.jsx b/platform/ui/src/components/ViewportGrid/ViewportGrid.jsx index bc525af4f..855e63df5 100644 --- a/platform/ui/src/components/ViewportGrid/ViewportGrid.jsx +++ b/platform/ui/src/components/ViewportGrid/ViewportGrid.jsx @@ -9,7 +9,7 @@ const ViewportGrid = ({ rows, cols, viewportContents }) => {