2024-09-11 20:57:19 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
|
|
2024-09-30 23:45:14 +02:00
|
|
|
import { StudyItem } from '../StudyItem';
|
|
|
|
|
import { StudyBrowserSort } from '../StudyBrowserSort';
|
|
|
|
|
import { StudyBrowserViewOptions } from '../StudyBrowserViewOptions';
|
2024-09-11 20:57:19 +02:00
|
|
|
|
|
|
|
|
const noop = () => {};
|
|
|
|
|
|
|
|
|
|
const StudyBrowser = ({
|
|
|
|
|
tabs,
|
|
|
|
|
activeTabName,
|
|
|
|
|
expandedStudyInstanceUIDs,
|
|
|
|
|
onClickTab = noop,
|
|
|
|
|
onClickStudy = noop,
|
|
|
|
|
onClickThumbnail = noop,
|
|
|
|
|
onDoubleClickThumbnail = noop,
|
|
|
|
|
onClickUntrack = noop,
|
|
|
|
|
activeDisplaySetInstanceUIDs,
|
|
|
|
|
servicesManager,
|
|
|
|
|
showSettings,
|
|
|
|
|
viewPresets,
|
2025-01-13 16:49:08 +01:00
|
|
|
ThumbnailMenuItems,
|
|
|
|
|
StudyMenuItems,
|
2024-09-11 20:57:19 +02:00
|
|
|
}: withAppTypes) => {
|
|
|
|
|
const getTabContent = () => {
|
|
|
|
|
const tabData = tabs.find(tab => tab.name === activeTabName);
|
|
|
|
|
const viewPreset = viewPresets
|
|
|
|
|
? viewPresets.filter(preset => preset.selected)[0]?.id
|
|
|
|
|
: 'thumbnails';
|
|
|
|
|
return tabData.studies.map(
|
|
|
|
|
({ studyInstanceUid, date, description, numInstances, modalities, displaySets }) => {
|
|
|
|
|
const isExpanded = expandedStudyInstanceUIDs.includes(studyInstanceUid);
|
|
|
|
|
return (
|
|
|
|
|
<React.Fragment key={studyInstanceUid}>
|
|
|
|
|
<StudyItem
|
|
|
|
|
date={date}
|
|
|
|
|
description={description}
|
|
|
|
|
numInstances={numInstances}
|
|
|
|
|
isExpanded={isExpanded}
|
|
|
|
|
displaySets={displaySets}
|
|
|
|
|
modalities={modalities}
|
|
|
|
|
isActive={isExpanded}
|
2025-01-13 16:49:08 +01:00
|
|
|
onClick={() => onClickStudy(studyInstanceUid)}
|
2024-09-11 20:57:19 +02:00
|
|
|
onClickThumbnail={onClickThumbnail}
|
|
|
|
|
onDoubleClickThumbnail={onDoubleClickThumbnail}
|
|
|
|
|
onClickUntrack={onClickUntrack}
|
|
|
|
|
activeDisplaySetInstanceUIDs={activeDisplaySetInstanceUIDs}
|
|
|
|
|
data-cy="thumbnail-list"
|
|
|
|
|
viewPreset={viewPreset}
|
2025-01-13 16:49:08 +01:00
|
|
|
ThumbnailMenuItems={ThumbnailMenuItems}
|
|
|
|
|
StudyMenuItems={StudyMenuItems}
|
|
|
|
|
StudyInstanceUID={studyInstanceUid}
|
2024-09-11 20:57:19 +02:00
|
|
|
/>
|
|
|
|
|
</React.Fragment>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
2024-11-12 18:33:45 +01:00
|
|
|
<div
|
|
|
|
|
className="ohif-scrollbar invisible-scrollbar bg-bkg-low flex flex-1 flex-col gap-[4px] overflow-auto"
|
|
|
|
|
data-cy={'studyBrowser-panel'}
|
|
|
|
|
>
|
2025-01-23 20:13:44 +01:00
|
|
|
<div className="flex flex-col gap-[4px]">
|
2024-11-12 18:33:45 +01:00
|
|
|
{showSettings && (
|
|
|
|
|
<div className="w-100 bg-bkg-low flex h-[48px] items-center justify-center gap-[10px] px-[8px] py-[10px]">
|
|
|
|
|
<>
|
|
|
|
|
<StudyBrowserViewOptions
|
|
|
|
|
tabs={tabs}
|
|
|
|
|
onSelectTab={onClickTab}
|
|
|
|
|
activeTabName={activeTabName}
|
|
|
|
|
/>
|
|
|
|
|
<StudyBrowserSort servicesManager={servicesManager} />
|
|
|
|
|
</>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2024-09-11 20:57:19 +02:00
|
|
|
{getTabContent()}
|
|
|
|
|
</div>
|
2024-11-06 13:15:27 +01:00
|
|
|
</div>
|
2024-09-11 20:57:19 +02:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
StudyBrowser.propTypes = {
|
|
|
|
|
onClickTab: PropTypes.func.isRequired,
|
|
|
|
|
onClickStudy: PropTypes.func,
|
|
|
|
|
onClickThumbnail: PropTypes.func,
|
|
|
|
|
onDoubleClickThumbnail: PropTypes.func,
|
|
|
|
|
onClickUntrack: PropTypes.func,
|
|
|
|
|
activeTabName: PropTypes.string.isRequired,
|
|
|
|
|
expandedStudyInstanceUIDs: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
|
|
|
activeDisplaySetInstanceUIDs: PropTypes.arrayOf(PropTypes.string),
|
|
|
|
|
tabs: PropTypes.arrayOf(
|
|
|
|
|
PropTypes.shape({
|
|
|
|
|
name: PropTypes.string.isRequired,
|
|
|
|
|
label: PropTypes.string.isRequired,
|
|
|
|
|
studies: PropTypes.arrayOf(
|
|
|
|
|
PropTypes.shape({
|
|
|
|
|
studyInstanceUid: PropTypes.string.isRequired,
|
|
|
|
|
date: PropTypes.string,
|
|
|
|
|
numInstances: PropTypes.number,
|
|
|
|
|
modalities: PropTypes.string,
|
|
|
|
|
description: PropTypes.string,
|
|
|
|
|
displaySets: PropTypes.arrayOf(
|
|
|
|
|
PropTypes.shape({
|
|
|
|
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
|
|
|
|
imageSrc: PropTypes.string,
|
|
|
|
|
imageAltText: PropTypes.string,
|
|
|
|
|
seriesDate: PropTypes.string,
|
|
|
|
|
seriesNumber: PropTypes.any,
|
|
|
|
|
numInstances: PropTypes.number,
|
|
|
|
|
description: PropTypes.string,
|
|
|
|
|
componentType: PropTypes.oneOf(['thumbnail', 'thumbnailTracked', 'thumbnailNoImage'])
|
|
|
|
|
.isRequired,
|
|
|
|
|
isTracked: PropTypes.bool,
|
|
|
|
|
/**
|
|
|
|
|
* Data the thumbnail should expose to a receiving drop target. Use a matching
|
|
|
|
|
* `dragData.type` to identify which targets can receive this draggable item.
|
|
|
|
|
* If this is not set, drag-n-drop will be disabled for this thumbnail.
|
|
|
|
|
*
|
|
|
|
|
* Ref: https://react-dnd.github.io/react-dnd/docs/api/use-drag#specification-object-members
|
|
|
|
|
*/
|
|
|
|
|
dragData: PropTypes.shape({
|
|
|
|
|
/** Must match the "type" a dropTarget expects */
|
|
|
|
|
type: PropTypes.string.isRequired,
|
|
|
|
|
}),
|
|
|
|
|
})
|
|
|
|
|
),
|
|
|
|
|
})
|
|
|
|
|
).isRequired,
|
|
|
|
|
})
|
|
|
|
|
),
|
2025-01-13 16:49:08 +01:00
|
|
|
StudyMenuItems: PropTypes.func,
|
2024-09-11 20:57:19 +02:00
|
|
|
};
|
|
|
|
|
|
2024-09-27 18:17:54 +02:00
|
|
|
export { StudyBrowser };
|