import React, { useState } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Icon, ButtonGroup, Button, Tooltip } from '@ohif/ui';
const classes = {
infoHeader: 'text-base text-primary-light',
infoText: 'text-base text-white',
firstRow: 'flex flex-col',
row: 'flex flex-col ml-4',
};
const ViewportActionBar = ({
studyData,
showNavArrows,
showPatientInfo: patientInfoVisibility,
onSeriesChange,
onHydrationClick,
}) => {
const [showPatientInfo, setShowPatientInfo] = useState(patientInfoVisibility);
// TODO -> Remake this component with a bunch of generic slots that can be filled,
// Its not generic at all, isTracked etc shouldn't be parts of this component.
// It shouldn't care that a tracking mode or SR exists.
// Things like the right/left buttons should be made into smaller
// Components you can compose.
// OHIF-200 ticket.
const {
label,
isTracked,
isLocked,
isHydrated,
modality,
studyDate,
currentSeries,
seriesDescription,
patientInformation,
} = studyData;
const {
patientName,
patientSex,
patientAge,
MRN,
thickness,
spacing,
scanner,
} = patientInformation;
const onPatientInfoClick = () => setShowPatientInfo(!showPatientInfo);
const renderIconStatus = () => {
if (modality === 'SR') {
return (
<>
SR
{isLocked && (
)}
{!isLocked && !isHydrated && (
Edit
)}
>
);
}
return (
{!isTracked ? (
) : (
Series is
tracked and
can be viewed in the measurement panel
}
>
)}
);
};
return (
{renderIconStatus()}
{label}
{studyDate}
S: {currentSeries}
{/* TODO:
This is tricky. Our "no-wrap" in truncate means this has a hard
length. The overflow forces ellipse. If we don't set max width
appropriately, this causes the ActionBar to overflow.
Can clean up by setting percentage widths + calc on parent
containers
*/}