fix: OHIF-386 Disable Export and Create Report buttons if there are no tracked measurements (#3102)
Use the disabled Button component variant when no tracked measurements are present. Made the buttons look as per the spec. Co-authored-by: Joe Boccanfuso <joe.boccanfuso@radicalimaging.com>
This commit is contained in:
parent
9b0d542526
commit
ac90df356e
@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next';
|
||||
|
||||
import { Button, ButtonGroup } from '@ohif/ui';
|
||||
|
||||
function ActionButtons({ onExportClick, onCreateReportClick }) {
|
||||
function ActionButtons({ onExportClick, onCreateReportClick, disabled }) {
|
||||
const { t } = useTranslation('MeasurementTable');
|
||||
|
||||
return (
|
||||
@ -12,20 +12,22 @@ function ActionButtons({ onExportClick, onCreateReportClick }) {
|
||||
<Button
|
||||
className="text-base px-2 py-2"
|
||||
size="initial"
|
||||
variant="outlined"
|
||||
color="default"
|
||||
border="secondary"
|
||||
variant={disabled ? 'disabled' : 'outlined'}
|
||||
color="black"
|
||||
border="primaryActive"
|
||||
onClick={onExportClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{t('Export')}
|
||||
</Button>
|
||||
<Button
|
||||
className="ml-2 px-2 text-base"
|
||||
variant="outlined"
|
||||
variant={disabled ? 'disabled' : 'outlined'}
|
||||
size="initial"
|
||||
color="black"
|
||||
border="secondary"
|
||||
border="primaryActive"
|
||||
onClick={onCreateReportClick}
|
||||
disabled={disabled}
|
||||
>
|
||||
{t('Create Report')}
|
||||
</Button>
|
||||
@ -36,11 +38,13 @@ function ActionButtons({ onExportClick, onCreateReportClick }) {
|
||||
ActionButtons.propTypes = {
|
||||
onExportClick: PropTypes.func,
|
||||
onCreateReportClick: PropTypes.func,
|
||||
disabled: PropTypes.bool,
|
||||
};
|
||||
|
||||
ActionButtons.defaultProps = {
|
||||
onExportClick: () => alert('Export'),
|
||||
onCreateReportClick: () => alert('Create Report'),
|
||||
disabled: false,
|
||||
};
|
||||
|
||||
export default ActionButtons;
|
||||
|
||||
@ -273,6 +273,10 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
||||
isBackupSave: true,
|
||||
});
|
||||
}}
|
||||
disabled={
|
||||
additionalFindings.length === 0 &&
|
||||
displayMeasurementsWithoutFindings.length === 0
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user