From 881009fb1007781275bf113bdd3ec94285e7c559 Mon Sep 17 00:00:00 2001 From: arunachalam-monk Date: Thu, 22 Aug 2024 16:48:56 +0530 Subject: [PATCH 01/18] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20enableAddDamage=20to?= =?UTF-8?q?=20addDamage=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/demo-app/src/local-config.json | 2 +- .../test/pages/PhotoCapturePage.test.tsx | 4 ++-- documentation/docs/photo-capture-workflow.md | 2 +- documentation/src/utils/schemas.ts | 3 ++- .../hooks/useInspectionGalleryItems.ts | 17 ++++--------- .../src/components/InspectionGallery/types.ts | 4 ++-- .../src/PhotoCapture/PhotoCapture.tsx | 9 +++---- .../PhotoCaptureHUD/PhotoCaptureHUD.tsx | 6 ++--- .../PhotoCaptureHUDElements.tsx | 4 ++-- .../AddDamageButton/AddDamageButton.tsx | 9 +++---- .../PhotoCaptureHUDElementsSight.tsx | 6 ++--- .../SightGuideline/SightGuideline.tsx | 9 +++---- .../PhotoCaptureHUDElementsSight/hooks.ts | 2 +- .../PhotoCaptureHUDTutorial.tsx | 4 ++-- .../test/PhotoCapture/PhotoCapture.test.tsx | 5 ++-- .../AddDamageButton.test.tsx | 9 +++---- .../SightGuideline.test.tsx | 3 ++- .../PhotoCaptureHUDTutorial.test.tsx | 3 ++- packages/types/src/config.ts | 24 +++++++++++++++---- 19 files changed, 71 insertions(+), 54 deletions(-) diff --git a/apps/demo-app/src/local-config.json b/apps/demo-app/src/local-config.json index fec061484..b89d13a6d 100644 --- a/apps/demo-app/src/local-config.json +++ b/apps/demo-app/src/local-config.json @@ -2,7 +2,7 @@ "id": "demo-app-dev", "description": "Config for the dev Demo App.", "allowSkipRetake": true, - "enableAddDamage": true, + "addDamage": "two_shot", "enableSightGuidelines": true, "allowVehicleTypeSelection": true, "allowManualLogin": true, diff --git a/apps/demo-app/test/pages/PhotoCapturePage.test.tsx b/apps/demo-app/test/pages/PhotoCapturePage.test.tsx index 187a62d64..82894cf9a 100644 --- a/apps/demo-app/test/pages/PhotoCapturePage.test.tsx +++ b/apps/demo-app/test/pages/PhotoCapturePage.test.tsx @@ -20,7 +20,7 @@ const appState = { enforceOrientation: 'test-enforceOrientation-test', maxUploadDurationWarning: 'test-maxUploadDurationWarning-test', allowSkipRetake: 'test-allowSkipRetake-test', - enableAddDamage: 'test-enableAddDamage-test', + addDamage: 'test-addDamage-test', enableCompliance: 'test-enableCompliance-test', enableCompliancePerSight: 'test-enableCompliancePerSight-test', complianceIssues: 'test-complianceIssues-test', @@ -53,7 +53,7 @@ describe('PhotoCapture page', () => { enforceOrientation: appState.config.enforceOrientation, maxUploadDurationWarning: appState.config.maxUploadDurationWarning, allowSkipRetake: appState.config.allowSkipRetake, - enableAddDamage: appState.config.enableAddDamage, + addDamage: appState.config.addDamage, enableCompliance: appState.config.enableCompliance, enableCompliancePerSight: appState.config.enableCompliancePerSight, complianceIssues: appState.config.complianceIssues, diff --git a/documentation/docs/photo-capture-workflow.md b/documentation/docs/photo-capture-workflow.md index 5490e6453..813c0fe02 100644 --- a/documentation/docs/photo-capture-workflow.md +++ b/documentation/docs/photo-capture-workflow.md @@ -58,7 +58,7 @@ increase the detection rate. This feature is called `Add Damage`, and there two take a close-up picture of the damage. For now, only the 2-shot workflow is implemented in the PhotoCapture workflow. This feature is enabled by default in the -`PhotoCapture` component. To disable it, pass the `enableAddDamage` prop to `false`. +`PhotoCapture` component. To disable it, pass the `addDamage` prop to `AddDamage.DISABLED`. TODO ## Using Compliance The compliance is a feature that allows our AI models to analyze the quality of the pictures taken by the user, and if diff --git a/documentation/src/utils/schemas.ts b/documentation/src/utils/schemas.ts index b64eda6f6..37c696c17 100644 --- a/documentation/src/utils/schemas.ts +++ b/documentation/src/utils/schemas.ts @@ -9,6 +9,7 @@ import { SteeringWheelPosition, TaskName, VehicleType, + AddDamage, } from '@monkvision/types'; import { sights } from '@monkvision/sights'; import { flatten } from '@monkvision/common'; @@ -270,7 +271,7 @@ export const LiveConfigSchema = z maxUploadDurationWarning: z.number().positive().or(z.literal(-1)).optional(), useAdaptiveImageQuality: z.boolean().optional(), allowSkipRetake: z.boolean().optional(), - enableAddDamage: z.boolean().optional(), + addDamage: z.nativeEnum(AddDamage).optional(), enableSightGuidelines: z.boolean().optional(), sightGuidelines: z.array(SightGuidelineSchema).optional(), enableTutorial: z.nativeEnum(PhotoCaptureTutorialOption).optional(), diff --git a/packages/common-ui-web/src/components/InspectionGallery/hooks/useInspectionGalleryItems.ts b/packages/common-ui-web/src/components/InspectionGallery/hooks/useInspectionGalleryItems.ts index 576b3c14c..d29107ee2 100644 --- a/packages/common-ui-web/src/components/InspectionGallery/hooks/useInspectionGalleryItems.ts +++ b/packages/common-ui-web/src/components/InspectionGallery/hooks/useInspectionGalleryItems.ts @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { ImageStatus, Sight } from '@monkvision/types'; +import { AddDamage, ImageStatus, Sight } from '@monkvision/types'; import { getInspectionImages, MonkState, useMonkState } from '@monkvision/common'; import { useInspectionPoll } from '@monkvision/network'; import { InspectionGalleryItem, InspectionGalleryProps } from '../types'; @@ -57,7 +57,7 @@ function getItems( captureMode: boolean, entities: MonkState, inspectionSights?: Sight[], - enableAddDamage?: boolean, + addDamage?: AddDamage, ): InspectionGalleryItem[] { const images = getInspectionImages(inspectionId, entities.images, captureMode); const items: InspectionGalleryItem[] = images.map((image) => ({ @@ -73,7 +73,7 @@ function getItems( items.push({ isTaken: false, isAddDamage: false, sightId: sight.id }); } }); - if (captureMode && enableAddDamage !== false) { + if (captureMode && (!addDamage || addDamage !== AddDamage.DISABLED)) { items.push({ isAddDamage: true }); } return items.sort((a, b) => compareGalleryItems(a, b, captureMode, inspectionSights)); @@ -93,15 +93,8 @@ export function useInspectionGalleryItems(props: InspectionGalleryProps): Inspec const { state } = useMonkState(); const items = useMemo( - () => - getItems( - props.inspectionId, - props.captureMode, - state, - inspectionSights, - props.enableAddDamage, - ), - [props.inspectionId, props.captureMode, state, inspectionSights, props.enableAddDamage], + () => getItems(props.inspectionId, props.captureMode, state, inspectionSights, props.addDamage), + [props.inspectionId, props.captureMode, state, inspectionSights, props.addDamage], ); const shouldFetch = useMemo(() => shouldContinueToFetch(items), items); diff --git a/packages/common-ui-web/src/components/InspectionGallery/types.ts b/packages/common-ui-web/src/components/InspectionGallery/types.ts index 01fbe9410..bb602e4dc 100644 --- a/packages/common-ui-web/src/components/InspectionGallery/types.ts +++ b/packages/common-ui-web/src/components/InspectionGallery/types.ts @@ -1,4 +1,4 @@ -import { ComplianceOptions, Image, Sight } from '@monkvision/types'; +import { AddDamage, ComplianceOptions, Image, Sight } from '@monkvision/types'; import { MonkApiConfig } from '@monkvision/network'; /** @@ -105,7 +105,7 @@ export type InspectionGalleryProps = { * * @default true */ - enableAddDamage?: boolean; + addDamage?: AddDamage; /** * Custom label for validate button. */ diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx index 33cf907bd..ab61087bf 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx @@ -24,6 +24,7 @@ import { DeviceOrientation, PhotoCaptureTutorialOption, Sight, + AddDamage, } from '@monkvision/types'; import { useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -59,7 +60,7 @@ export interface PhotoCaptureProps | 'showCloseButton' | 'enforceOrientation' | 'allowSkipRetake' - | 'enableAddDamage' + | 'addDamage' | 'sightGuidelines' | 'enableSightGuidelines' | 'enableTutorial' @@ -129,7 +130,7 @@ export function PhotoCapture({ customComplianceThresholdsPerSight, useLiveCompliance = false, allowSkipRetake = false, - enableAddDamage = true, + addDamage = AddDamage.TWO_SHOT, sightGuidelines, enableTutorial = PhotoCaptureTutorialOption.FIRST_TIME_ONLY, allowSkipTutorial = true, @@ -268,7 +269,7 @@ export function PhotoCapture({ inspectionId, showCloseButton, images, - enableAddDamage, + addDamage, sightGuidelines, enableSightGuidelines, currentTutorialStep, @@ -310,7 +311,7 @@ export function PhotoCapture({ onBack={handleGalleryBack} onNavigateToCapture={handleNavigateToCapture} onValidate={handleGalleryValidate} - enableAddDamage={enableAddDamage} + addDamage={addDamage} validateButtonLabel={validateButtonLabel} isInspectionCompleted={sightState.isInspectionCompleted} {...complianceOptions} diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx index 67394cce7..18ba9300b 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx @@ -21,7 +21,7 @@ export interface PhotoCaptureHUDProps CaptureAppConfig, | 'enableSightGuidelines' | 'sightGuidelines' - | 'enableAddDamage' + | 'addDamage' | 'showCloseButton' | 'allowSkipTutorial' > { @@ -124,7 +124,7 @@ export function PhotoCaptureHUD({ handle, cameraPreview, images, - enableAddDamage, + addDamage, sightGuidelines, enableSightGuidelines, currentTutorialStep, @@ -169,7 +169,7 @@ export function PhotoCaptureHUD({ error={loading.error ?? handle.error} previewDimensions={handle.previewDimensions} images={images} - enableAddDamage={enableAddDamage} + addDamage={addDamage} sightGuidelines={sightGuidelines} enableSightGuidelines={enableSightGuidelines} tutorialStep={currentTutorialStep} diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements/PhotoCaptureHUDElements.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements/PhotoCaptureHUDElements.tsx index 7d68858db..64d1411c1 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements/PhotoCaptureHUDElements.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements/PhotoCaptureHUDElements.tsx @@ -8,7 +8,7 @@ import { PhotoCaptureHUDElementsAddDamage2ndShot } from '../PhotoCaptureHUDEleme * Props of the PhotoCaptureHUDElements component. */ export interface PhotoCaptureHUDElementsProps - extends Pick { + extends Pick { /** * The currently selected sight in the PhotoCapture component : the sight that the user needs to capture. */ @@ -81,7 +81,7 @@ export function PhotoCaptureHUDElements(params: PhotoCaptureHUDElementsProps) { onAddDamage={params.onAddDamage} previewDimensions={params.previewDimensions} images={params.images} - enableAddDamage={params.enableAddDamage} + addDamage={params.addDamage} sightGuidelines={params.sightGuidelines} enableSightGuidelines={params.enableSightGuidelines} tutorialStep={params.tutorialStep} diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/AddDamageButton/AddDamageButton.tsx b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/AddDamageButton/AddDamageButton.tsx index 44e5dbf65..92a727820 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/AddDamageButton/AddDamageButton.tsx +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/AddDamageButton/AddDamageButton.tsx @@ -1,4 +1,5 @@ import { Button } from '@monkvision/common-ui-web'; +import { AddDamage } from '@monkvision/types'; import { useTranslation } from 'react-i18next'; import { usePhotoCaptureHUDButtonBackground } from '../../hooks'; @@ -13,21 +14,21 @@ export interface AddDamageButtonProps { /** * Boolean indicating whether the Add Damage feature is enabled. If disabled, the `Add Damage` button will be hidden. * - * @default true + * @default AddDamage.DISABLED */ - enableAddDamage?: boolean; + addDamage?: AddDamage; } /** * Custom button displayed in the PhotoCapture Camera HUD that allows user to enter add damage mode. */ -export function AddDamageButton({ onAddDamage, enableAddDamage }: AddDamageButtonProps) { +export function AddDamageButton({ onAddDamage, addDamage }: AddDamageButtonProps) { const { t } = useTranslation(); const primaryColor = usePhotoCaptureHUDButtonBackground(); return ( <> - {enableAddDamage && ( + {addDamage && addDamage !== AddDamage.DISABLED && ( + + - - {selectedParts.length !== 0 && ( -
- {selectedParts - .map((part) => vehiclePartLabels[part][getLanguage(i18n.language)]) - .join(', ')} -
- )} - - + } + /> ); } diff --git a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot/usePhotoCaptureHUDElementsAddPartSelectShotStyle.ts b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot/usePhotoCaptureHUDElementsAddPartSelectShotStyle.ts index 8ce6a3be7..ed18c0d91 100644 --- a/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot/usePhotoCaptureHUDElementsAddPartSelectShotStyle.ts +++ b/packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot/usePhotoCaptureHUDElementsAddPartSelectShotStyle.ts @@ -1,57 +1,29 @@ import { useMonkTheme } from '@monkvision/common'; import { CSSProperties } from 'react'; -import { PHOTO_CAPTURE_HUD_BUTTONS_BAR_WIDTH } from '../PhotoCaptureHUDButtons/PhotoCaptureHUDButtons.styles'; export function usePhotoCaptureHUDElementsAddPartSelectShotStyle(): Record< - | 'notification' - | 'closeButton' - | 'infoNotification' - | 'partSelectNotification' - | 'stackItem' - | 'wrapper', + 'popup' | 'dialogButtonGroup' | 'vehicleSelect' | 'button', CSSProperties > { const { palette } = useMonkTheme(); + const minValueWithAspectRatio = (width: number) => `min(${width}dvw, calc(${width}dvh * 1.5))`; return { - notification: { - position: 'absolute', - padding: '10px 20px', - borderRadius: 30, - color: palette.information.xdark, - backgroundColor: palette.information.xlight, - }, - infoNotification: { - top: 20, - }, - partSelectNotification: { - bottom: 20, - maxWidth: `calc(98% - (${PHOTO_CAPTURE_HUD_BUTTONS_BAR_WIDTH * 8}px))`, - fontSize: 14, - }, - stackItem: { - position: 'absolute', - inset: 0, + popup: { + width: `clamp(${minValueWithAspectRatio(80)}, 80%, ${minValueWithAspectRatio(90)})`, backgroundColor: palette.background.base, display: 'flex', - justifyContent: 'center', - alignItems: 'center', - flexDirection: 'column', - }, - wrapper: { - width: `calc(98% - (${PHOTO_CAPTURE_HUD_BUTTONS_BAR_WIDTH * 4}px))`, - height: '100%', - backgroundColor: palette.background.dark, - display: 'flex', - justifyContent: 'center', flexDirection: 'column', + justifyItems: 'center', + padding: '3svw', + gap: 10, + borderRadius: '3svmin', alignItems: 'center', + boxSizing: 'border-box', + overflow: 'scroll', + maxHeight: '100%', }, - closeButton: { - position: 'absolute', - left: 22, - top: 22, - width: 44, - height: 44, - }, + dialogButtonGroup: { display: 'flex', gap: 20 }, + vehicleSelect: { alignSelf: 'stretch', justifySelf: 'stretch' }, + button: { padding: '.5svw 2svw', fontSize: 'min(14px, 3svmin)', borderRadius: '4svmin' }, }; } diff --git a/packages/inspection-capture-web/src/translations/de.json b/packages/inspection-capture-web/src/translations/de.json index 16f0c387b..9f5479e5a 100644 --- a/packages/inspection-capture-web/src/translations/de.json +++ b/packages/inspection-capture-web/src/translations/de.json @@ -18,7 +18,9 @@ "closeupPictureCounter": "2 / 2 • Nahaufnahme-Vorschau", "infoBtn": "Richte das Ziel auf den beschädigten Teil aus und tippe dann auf den Auslöserknopf", "infoCloseup": "Ein Nahaufnahmebild von dem Schaden machen", - "selectParts": "Wählen Sie die Teile aus, an denen Sie Schaden nehmen" + "selectParts": "Wählen Sie die Teile aus, an denen Sie Schaden nehmen", + "accept": "Akzeptieren", + "cancel": "Stornieren" }, "error": { "retry": "Erneut versuchen", diff --git a/packages/inspection-capture-web/src/translations/en.json b/packages/inspection-capture-web/src/translations/en.json index 14fbe56f6..8486c42b5 100644 --- a/packages/inspection-capture-web/src/translations/en.json +++ b/packages/inspection-capture-web/src/translations/en.json @@ -18,7 +18,9 @@ "closeupPictureCounter": "2 / 2 • Closeup Picture", "infoBtn": "Aim the target at the damaged part then tap the shutter button", "infoCloseup": "Take a closeup picture of the damage", - "selectParts": "Select the parts where you damage is" + "selectParts": "Select the parts where you damage is", + "accept": "Accept", + "cancel": "Cancel" }, "error": { "retry": "Retry", diff --git a/packages/inspection-capture-web/src/translations/fr.json b/packages/inspection-capture-web/src/translations/fr.json index 05bdda44a..7b25c7b0d 100644 --- a/packages/inspection-capture-web/src/translations/fr.json +++ b/packages/inspection-capture-web/src/translations/fr.json @@ -18,7 +18,9 @@ "closeupPictureCounter": "2 / 2 • Dégât en gros plan", "infoBtn": "Placer le viseur sur la pièce endommagée puis enclencher le bouton capture de la photo", "infoCloseup": "Prendre une photo en gros plan du dégât", - "selectParts": "Sélectionnez les pièces où vous endommagez" + "selectParts": "Sélectionnez les pièces où vous endommagez", + "accept": "Accepter", + "cancel": "Annuler" }, "error": { "retry": "Réessayer", diff --git a/packages/inspection-capture-web/src/translations/nl.json b/packages/inspection-capture-web/src/translations/nl.json index a8625fea3..08b805592 100644 --- a/packages/inspection-capture-web/src/translations/nl.json +++ b/packages/inspection-capture-web/src/translations/nl.json @@ -18,7 +18,9 @@ "closeupPictureCounter": "2 / 2 • Closeup foto", "infoBtn": "Richt de markering op het beschadigde onderdeel en tik vervolgens op de sluitertknop", "infoCloseup": "Neem een closeup foto van de schade", - "selectParts": "Selecteer de onderdelen waar je schade zit" + "selectParts": "Selecteer de onderdelen waar je schade zit", + "accept": "Accepteren", + "cancel": "Annuleren" }, "error": { "retry": "Opnieuw proberen", diff --git a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.test.tsx b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.test.tsx index 6520c6698..58d70167d 100644 --- a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.test.tsx +++ b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.test.tsx @@ -48,7 +48,6 @@ function createProps(): PhotoCaptureHUDProps { loading: { isLoading: false, error: null } as unknown as LoadingState, onSelectSight: jest.fn(), onRetakeSight: jest.fn(), - damageVehicleParts: [], onAddDamageParts: jest.fn(), onAddDamage: jest.fn(), onCancelAddDamage: jest.fn(), @@ -204,13 +203,6 @@ describe('PhotoCaptureHUD component', () => { unmount(); }); - it('should set takePictureDisabled to true when on part select', () => { - const props = createProps(); - props.mode = PhotoCaptureMode.ADD_DAMAGE_PART_SELECT; - render(); - expectPropsOnChildMock(PhotoCaptureHUDButtons, { takePictureDisabled: true }); - }); - it('should set showActionButton to true on part select', () => { const props = createProps(); props.mode = PhotoCaptureMode.ADD_DAMAGE_PART_SELECT; diff --git a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements.test.tsx b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements.test.tsx index 8e2b7a3ae..33949e78a 100644 --- a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements.test.tsx +++ b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements.test.tsx @@ -55,7 +55,6 @@ function createProps(): PhotoCaptureHUDElementsProps { tutorialStep: null, addDamage: AddDamage.TWO_SHOT, onAddDamageParts: jest.fn(), - addDamagePartSelectState: 'part-select', }; } @@ -138,7 +137,6 @@ describe('PhotoCaptureHUDElements component', () => { expectPropsOnChildMock(PhotoCaptureHUDElementsAddPartSelectShot, { onCancel: props.onCancelAddDamage, onAddDamageParts: props.onAddDamageParts, - partSelectState: props.addDamagePartSelectState, }); expect(PhotoCaptureHUDElementsSight).not.toHaveBeenCalled(); expect(PhotoCaptureHUDElementsAddDamage1stShot).not.toHaveBeenCalled(); diff --git a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot.test.tsx b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot.test.tsx index 4860d872c..878b91762 100644 --- a/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot.test.tsx +++ b/packages/inspection-capture-web/test/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsAddPartSelectShot.test.tsx @@ -1,5 +1,10 @@ import { getLanguage, MonkAppState, useMonkAppState } from '@monkvision/common'; -import { Button, VehiclePartSelection } from '@monkvision/common-ui-web'; +import { + BackdropDialog, + BackdropDialogProps, + Button, + VehiclePartSelection, +} from '@monkvision/common-ui-web'; import { expectPropsOnChildMock } from '@monkvision/test-utils'; import { VehiclePart, VehicleType } from '@monkvision/types'; import { act, fireEvent, prettyDOM, render } from '@testing-library/react'; @@ -11,90 +16,89 @@ describe('PhotoCaptureHUDElementsAddPartSelectShot component', () => { (useMonkAppState as jest.MockedFunction).mockReturnValue({ vehicleType: VehicleType.CUV, } as ReturnType infer R ? (args: any) => R : never>); + (BackdropDialog as jest.MockedFunction).mockImplementation((props) => { + const { dialog } = props as Extract; + return dialog; + }); + (Button as jest.MockedFunction).mockImplementation((props) => { + const { children, onClick } = props; + return ; + }); }); afterEach(() => jest.clearAllMocks()); - it('should call onCancel callback on close button click', () => { - const onCancel = jest.fn(); - (Button as jest.MockedFunction).mockImplementation(({ onClick }) => ( -