Skip to content

C3DC-1571 #330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 13 additions & 42 deletions src/pages/CohortAnalyzer/CohortAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ export const CohortAnalyzer = () => {
const { Notification } = useGlobal();
const [mousePosition, setMousePosition] = useState({ x: 0, y: 0 });
const [HoveredCohort, setHoveredCohort] = useState(true);
const [tooltipOpen, setTooltipOpen] = useState(false);
const [tooltipOpenExplore, setTooltipOpenExplore] = useState(false);
const navigate = useNavigate();

let movedToToolTipText = false;
Expand Down Expand Up @@ -118,32 +116,6 @@ export const CohortAnalyzer = () => {

return finalUrl;
}

const handleHideTooltip = (eventSource) => {
if (eventSource === "tooltipText") {
setTooltipOpen(false);
} else if (eventSource === "questionIcon") {
setTimeout(() => {
if (!movedToToolTipText) {
setTooltipOpen(false);
}
}, 1000);
}

}

const handleHideTooltipExplore = (eventSource) => {
if (eventSource === "tooltipText") {
setTooltipOpenExplore(false);
} else if (eventSource === "questionIcon") {
setTimeout(() => {
if (!movedToToolTipTextExplore) {
setTooltipOpenExplore(false);
}
}, 1000);
}

}

const handleMouseMove = (event, cohortName) => {

Expand Down Expand Up @@ -896,61 +868,60 @@ padding-left: 5px;
</div>

{/* BUILD IN EXPLORE DASHBOARD */}
<div style={{ display: 'flex', alignItems: 'center', marginRight: '-10px' }}>
<div style={{ position:"relative", marginRight: '6px' }}>
<button
onClick={() => selectedCohorts.length > 0 && handleBuildInExplore()}
className={selectedCohorts.length > 0 ? classes.exploreButton : classes.exploreButtonFaded}
>
BUILD IN EXPLORE DASHBOARD
</button>
<div style={{ position:"absolute",top:-5,right:-13, }}>
<ToolTip
open={tooltipOpen}
disableHoverListener
maxWidth="335px"
border={'1px solid #598ac5'}
arrowBorder={'1px solid #598AC5'}
title={<div onMouseEnter={() => { movedToToolTipText = true; setTooltipOpen(true); }} onMouseLeave={() => handleHideTooltip("tooltipText")}>
title={<div>
{exploreDashboardTooltip}
</div>}
placement="top-end"
arrow
interactive
arrowSize="30px"
>
<div style={{ marginLeft: 5 }}>
<img alt="Question Icon" src={questionIcon} width={10} style={{ position: 'relative', top: -14, left: -2 }} onMouseEnter={() => { movedToToolTipText = false; setTooltipOpen(true); }} onMouseLeave={() => handleHideTooltip("questionIcon")} />
</div>

<img alt="Question Icon" src={questionIcon} width={10} style={{border:"0px"}} />

</ToolTip>
</div>
</div>

{/* EXPLORE IN CCDI HUB */}
<div style={{ display: 'flex', alignItems: 'center' }}>
<div style={{ position:"relative", marginRight: '10px' }}>
<button
onClick={() => (selectedCohorts.length > 0 && rowData.length <= 600) ? handleExportToCCDIHub(): {}}
className={(selectedCohorts.length > 0 && rowData.length <= 600) ? classes.exploreButton : classes.exploreButtonFaded}
>
EXPLORE IN CCDI HUB
<img alt="link out icon" src={linkoutIcon} height={13} width={13} />
</button>
<div style={{ position:"absolute",top:-5,right:-13, }}>
<ToolTip
open={tooltipOpenExplore}
disableHoverListener
maxWidth="335px"
border={'1px solid #598ac5'}
arrowBorder={'1px solid #598AC5'}
title={<div onMouseEnter={() => { movedToToolTipTextExplore = true; setTooltipOpenExplore(true); }} onMouseLeave={() => handleHideTooltipExplore("tooltipText")}>
title={<div >
{exploreCCDIHubTooltip}
</div>}
placement="top-end"
arrow
interactive
arrowSize="30px"
>
<div style={{ marginLeft: 5 }}>
<img alt="Question Icon" src={questionIcon} width={10} style={{ position: 'relative', top: -14, left: -2 }} onMouseEnter={() => { movedToToolTipTextExplore = false; setTooltipOpenExplore(true); }} onMouseLeave={() => handleHideTooltipExplore("questionIcon")} />
</div>
<img alt="Question Icon" src={questionIcon} width={10} style={{border:"0px"}}/>

</ToolTip>
</div>
</div>
</div>
</div>
<div className={classes.rightSideTableContainer}>
Expand Down
28 changes: 2 additions & 26 deletions src/pages/inventory/cohortModal/components/cohortDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ const CohortDetails = (props) => {
const [isEditingDescription, setIsEditingDescription] = useState(false);
const [showDownloadDropdown, setShowDownloadDropdown] = useState(false);
const [isScrollbarActive, setIsScrollbarActive] = useState(false);
const [showToolTip, setShowToolTip] = useState(false);
const movedToToolTipText = useRef(false);

const scrollContainerRef = useRef(null);
const descriptionRef = useRef(null);
Expand All @@ -65,7 +63,6 @@ const CohortDetails = (props) => {

const generateCCDIHub_url = (cohortId) => {
tooltipOpen.current = false;
setShowToolTip(false);
const data = cohortId;
const participantIds = data.participants.map(p => p.participant_id).join("|");
const dbgapAccessions = [...new Set(data.participants.map(p => p.dbgap_accession))].join("|");
Expand Down Expand Up @@ -117,10 +114,6 @@ const CohortDetails = (props) => {
}
}, [isEditingDescription]);

useEffect(() => {
setShowToolTip(tooltipOpen.current);
}, [tooltipOpen.current]);

const handleClickOutside = (event) => {
if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
setShowDownloadDropdown(false); // Close the dropdown when clicking outside
Expand All @@ -143,19 +136,6 @@ const CohortDetails = (props) => {
});
}

const handleHideTooltip = (eventSource) => {
if (eventSource === "tooltipText") {
tooltipOpen.current = false;
setShowToolTip(false);
} else if (eventSource === "questionIcon") {
setTimeout(() => {
if (!movedToToolTipText.current) {
tooltipOpen.current = false;
setShowToolTip(false);}
}, 350);
}
}

const handleViewAnalysisClick = (cohort)=>{
navigate(`/cohortAnalyzer`,{state:{cohort}});
}
Expand Down Expand Up @@ -290,7 +270,7 @@ const CohortDetails = (props) => {
<Gap/>
<b>If cohort size &gt; 600:</b><br/>
Download the manifest and upload it manually to the&nbsp;
<a style={{zIndex: 10000}} onClick={()=>{tooltipOpen.current = false; setShowToolTip(false);}} target='_blank' href="https://ccdi.cancer.gov/explore" rel="noreferrer">
<a style={{zIndex: 10000}} target='_blank' href="https://ccdi.cancer.gov/explore" rel="noreferrer">
CCDI Hub
<img
src={LinkoutBlue}
Expand Down Expand Up @@ -557,10 +537,8 @@ const CohortDetails = (props) => {
</Button>
</ToolTip>
<ToolTip
open={tooltipOpen.current}
disableHoverListener
maxWidth="335px"
title={<div onMouseEnter={() => { movedToToolTipText.current=true; tooltipOpen.current = true; setShowToolTip(true);}} onMouseLeave={() => handleHideTooltip("tooltipText")}>
title={<div>
{exploreCCDIHubTooltip}
</div>}
placement="top-end"
Expand All @@ -569,8 +547,6 @@ const CohortDetails = (props) => {
arrowSize="30px"
>
<Button
onMouseEnter={()=>{ movedToToolTipText.current = false; tooltipOpen.current = true; setShowToolTip(true);}}
onMouseLeave={() => handleHideTooltip("questionIcon")}
variant="contained"
className={ localCohort.participants.length > 600? classes.exploreButtonFaded : classes.exploreButton }
onClick={() => localCohort.participants.length <= 600 && generateCCDIHub_url(localCohort)}
Expand Down
Loading