diff --git a/apps/drive-app/src/pages/PhotoCapturePage/PhotoCapturePage.tsx b/apps/drive-app/src/pages/PhotoCapturePage/PhotoCapturePage.tsx index 0995e962d..48c5ebb5b 100644 --- a/apps/drive-app/src/pages/PhotoCapturePage/PhotoCapturePage.tsx +++ b/apps/drive-app/src/pages/PhotoCapturePage/PhotoCapturePage.tsx @@ -44,6 +44,7 @@ export function PhotoCapturePage() { enforceOrientation={DeviceOrientation.LANDSCAPE} allowSkipRetake={false} useLiveCompliance={true} + disableAddDamage={true} /> ); diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx index 1e311cb13..ce5efa037 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx @@ -89,6 +89,12 @@ export interface PhotoCaptureProps * @default false */ allowSkipRetake?: boolean; + /** + * Boolean indicating if `Add Damage` feature should be enabled or not. If disabled, the `Add Damage` button will be hidden. + * + * @default true + */ + enableAddDamage?: boolean; } enum PhotoCaptureScreen { @@ -109,6 +115,7 @@ export function PhotoCapture({ enableCompliance = true, useLiveCompliance = false, allowSkipRetake = false, + enableAddDamage = true, complianceIssues, lang, enforceOrientation, @@ -204,6 +211,7 @@ export function PhotoCapture({ inspectionId, showCloseButton, images, + enableAddDamage, }; return ( diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx index 155f3066d..691cda1bf 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx @@ -77,6 +77,12 @@ export interface PhotoCaptureHUDProps extends CameraHUDProps { * The current images taken by the user (ignoring retaken pictures etc.). */ images: Image[]; + /** + * Boolean indicating if `Add Damage` feature should be enabled or not. If disabled, the `Add Damage` button will be hidden. + * + * @default true + */ + enableAddDamage?: boolean; } /** @@ -102,6 +108,7 @@ export function PhotoCaptureHUD({ handle, cameraPreview, images, + enableAddDamage, }: PhotoCaptureHUDProps) { const { t } = useTranslation(); const [showCloseModal, setShowCloseModal] = useState(false); @@ -135,6 +142,7 @@ export function PhotoCaptureHUD({ error={loading.error ?? handle.error} streamDimensions={handle.dimensions} images={images} + enableAddDamage={enableAddDamage} /> ); } diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDPreviewSight/AddDamageButton/AddDamageButton.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDPreviewSight/AddDamageButton/AddDamageButton.tsx index c88e6d7ae..4cd29d2b7 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDPreviewSight/AddDamageButton/AddDamageButton.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDPreviewSight/AddDamageButton/AddDamageButton.tsx @@ -1,4 +1,5 @@ import { Button } from '@monkvision/common-ui-web'; +import { CSSProperties } from 'react'; import { useTranslation } from 'react-i18next'; import { usePhotoCaptureHUDButtonBackground } from '../../hooks'; @@ -10,18 +11,30 @@ export interface AddDamageButtonProps { * Callback called when the user presses the button. */ onAddDamage?: () => void; + /** + * Boolean indicating whether the Add Damage feature is enabled. If disabled, the `Add Damage` button will be hidden. + * + * @default true + */ + enableAddDamage?: boolean; +} + +function getButtonStyle(enableAddDamage?: boolean): CSSProperties { + return { visibility: enableAddDamage ? 'visible' : 'hidden' }; } /** * Custom button displayed in the PhotoCapture Camera HUD that allows user to enter add damage mode. */ -export function AddDamageButton({ onAddDamage }: AddDamageButtonProps) { +export function AddDamageButton({ onAddDamage, enableAddDamage }: AddDamageButtonProps) { const { t } = useTranslation(); const primaryColor = usePhotoCaptureHUDButtonBackground(); return (