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';
|
import { Button, ButtonGroup } from '@ohif/ui';
|
||||||
|
|
||||||
function ActionButtons({ onExportClick, onCreateReportClick }) {
|
function ActionButtons({ onExportClick, onCreateReportClick, disabled }) {
|
||||||
const { t } = useTranslation('MeasurementTable');
|
const { t } = useTranslation('MeasurementTable');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -12,20 +12,22 @@ function ActionButtons({ onExportClick, onCreateReportClick }) {
|
|||||||
<Button
|
<Button
|
||||||
className="text-base px-2 py-2"
|
className="text-base px-2 py-2"
|
||||||
size="initial"
|
size="initial"
|
||||||
variant="outlined"
|
variant={disabled ? 'disabled' : 'outlined'}
|
||||||
color="default"
|
color="black"
|
||||||
border="secondary"
|
border="primaryActive"
|
||||||
onClick={onExportClick}
|
onClick={onExportClick}
|
||||||
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
{t('Export')}
|
{t('Export')}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
className="ml-2 px-2 text-base"
|
className="ml-2 px-2 text-base"
|
||||||
variant="outlined"
|
variant={disabled ? 'disabled' : 'outlined'}
|
||||||
size="initial"
|
size="initial"
|
||||||
color="black"
|
color="black"
|
||||||
border="secondary"
|
border="primaryActive"
|
||||||
onClick={onCreateReportClick}
|
onClick={onCreateReportClick}
|
||||||
|
disabled={disabled}
|
||||||
>
|
>
|
||||||
{t('Create Report')}
|
{t('Create Report')}
|
||||||
</Button>
|
</Button>
|
||||||
@ -36,11 +38,13 @@ function ActionButtons({ onExportClick, onCreateReportClick }) {
|
|||||||
ActionButtons.propTypes = {
|
ActionButtons.propTypes = {
|
||||||
onExportClick: PropTypes.func,
|
onExportClick: PropTypes.func,
|
||||||
onCreateReportClick: PropTypes.func,
|
onCreateReportClick: PropTypes.func,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
||||||
ActionButtons.defaultProps = {
|
ActionButtons.defaultProps = {
|
||||||
onExportClick: () => alert('Export'),
|
onExportClick: () => alert('Export'),
|
||||||
onCreateReportClick: () => alert('Create Report'),
|
onCreateReportClick: () => alert('Create Report'),
|
||||||
|
disabled: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default ActionButtons;
|
export default ActionButtons;
|
||||||
|
|||||||
@ -273,6 +273,10 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
isBackupSave: true,
|
isBackupSave: true,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
|
disabled={
|
||||||
|
additionalFindings.length === 0 &&
|
||||||
|
displayMeasurementsWithoutFindings.length === 0
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user