Skip to content

Commit cab82e7

Browse files
committed
Added SightTutorial to PhotoCapture
1 parent ce64bbe commit cab82e7

30 files changed

+572
-16
lines changed

apps/demo-app/src/local-config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
},
1515
"apiDomain": "api.preview.monk.ai/v1",
1616
"thumbnailDomain": "api.preview.monk.ai/image_resize",
17-
"enableSightTutorial": false,
1817
"enableTutorial": "first_time_only",
18+
"enableSightTutorial": "classic",
1919
"startTasksOnComplete": true,
2020
"showCloseButton": false,
2121
"enforceOrientation": "landscape",

documentation/src/utils/schemas.ts

+9
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ export const SightGuidelineSchema = z.object({
105105
nl: z.string(),
106106
});
107107

108+
export const SightTutorialSchema = z.object({
109+
imageReferenceBySightId: z.record(z.string().nullable()),
110+
en: z.string(),
111+
fr: z.string(),
112+
de: z.string(),
113+
nl: z.string(),
114+
});
115+
108116
export const AccentColorVariantsSchema = z.object({
109117
xdark: z.string(),
110118
dark: z.string(),
@@ -322,6 +330,7 @@ export const LiveConfigSchema = z
322330
enableTutorial: z.nativeEnum(PhotoCaptureTutorialOption).optional(),
323331
allowSkipTutorial: z.boolean().optional(),
324332
enableSightTutorial: z.boolean().optional(),
333+
sightTutorial: z.array(SightGuidelineSchema).optional(),
325334
defaultVehicleType: z.nativeEnum(VehicleType),
326335
allowManualLogin: z.boolean(),
327336
allowVehicleTypeSelection: z.boolean(),

documentation/src/utils/schemas/photoCaptureConfig.schema.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ComplianceOptionsSchema } from '@site/src/utils/schemas/compliance.sche
44
import {
55
CaptureWorkflow,
66
PhotoCaptureSightGuidelinesOption,
7+
PhotoCaptureSightTutorialOption,
78
PhotoCaptureTutorialOption,
89
TaskName,
910
VehicleType,
@@ -33,7 +34,7 @@ export const PhotoCaptureAppConfigSchema = z
3334
allowVehicleTypeSelection: z.boolean(),
3435
enableTutorial: z.nativeEnum(PhotoCaptureTutorialOption).optional(),
3536
allowSkipTutorial: z.boolean().optional(),
36-
enableSightTutorial: z.boolean().optional(),
37+
enableSightTutorial: z.nativeEnum(PhotoCaptureSightTutorialOption).optional(),
3738
})
3839
.and(SharedCaptureAppConfigSchema)
3940
.and(ComplianceOptionsSchema)

packages/inspection-capture-web/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export function MonkPhotoCapturePage({ authToken }) {
8585
| enableSightGuideline | `boolean` | Boolean indicating whether the sight guideline feature is enabled. If disabled, the guideline text will be hidden. | | `true` |
8686
| enableTutorial | `PhotoCaptureTutorialOption` | Options for displaying the photo capture tutorial. | | `PhotoCaptureTutorialOption.FIRST_TIME_ONLY` |
8787
| allowSkipTutorial | `boolean` | Boolean indicating if the user can skip the PhotoCapture tutorial. | | `true` |
88+
| sightTutorial | `sightTutorial[]` | A collection of sight tutorial in different language with a list of sightIds associate to it. | | |
8889
| enableSightTutorial | `boolean` | Boolean indicating whether the sight tutorial feature is enabled. | | `true` |
8990
| enableCompliance | `boolean` | Indicates if compliance checks should be enabled or not. | | `true` |
9091
| enableCompliancePerSight | `string[]` | Array of Sight IDs that indicates for which sight IDs the compliance should be enabled. | | |

packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.styles.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Styles } from '@monkvision/types';
22

33
export const styles: Styles = {
44
container: {
5-
height: '100%',
5+
height: '100dvh',
66
width: '100%',
77
},
88
};

packages/inspection-capture-web/src/PhotoCapture/PhotoCapture.tsx

+10-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
PhotoCaptureAppConfig,
1717
PhotoCaptureSightGuidelinesOption,
1818
PhotoCaptureTutorialOption,
19+
PhotoCaptureSightTutorialOption,
1920
Sight,
2021
VehicleType,
2122
} from '@monkvision/types';
@@ -38,6 +39,7 @@ import {
3839
usePhotoCaptureSightState,
3940
usePhotoCaptureTutorial,
4041
usePhotoCaptureSightGuidelines,
42+
usePhotoCaptureSightTutorial,
4143
useInspectionComplete,
4244
} from './hooks';
4345

@@ -62,6 +64,7 @@ export interface PhotoCaptureProps
6264
| 'enableTutorial'
6365
| 'allowSkipTutorial'
6466
| 'enableSightTutorial'
67+
| 'sightTutorial'
6568
>,
6669
Partial<ComplianceOptions> {
6770
/**
@@ -138,7 +141,8 @@ export function PhotoCapture({
138141
sightGuidelines,
139142
enableTutorial = PhotoCaptureTutorialOption.FIRST_TIME_ONLY,
140143
allowSkipTutorial = true,
141-
enableSightTutorial = true,
144+
enableSightTutorial = PhotoCaptureSightTutorialOption.DISABLED,
145+
sightTutorial,
142146
enableSightGuidelines = PhotoCaptureSightGuidelinesOption.EPHEMERAL,
143147
useAdaptiveImageQuality = true,
144148
lang,
@@ -205,6 +209,7 @@ export function PhotoCapture({
205209
enableSightGuidelines,
206210
enableSightTutorial,
207211
});
212+
const { showSightTutorial, toggleSightTutorial } = usePhotoCaptureSightTutorial();
208213
const { showSightGuidelines, handleDisableSightGuidelines } = usePhotoCaptureSightGuidelines({
209214
enableSightGuidelines,
210215
});
@@ -280,6 +285,10 @@ export function PhotoCapture({
280285
allowSkipTutorial,
281286
enforceOrientation,
282287
vehicleType,
288+
sightTutorial,
289+
enableSightTutorial,
290+
showSightTutorial,
291+
toggleSightTutorial,
283292
};
284293

285294
return (

packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUD.tsx

+25
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { PhotoCaptureHUDElements } from './PhotoCaptureHUDElements';
1818
import { PhotoCaptureHUDTutorial } from './PhotoCaptureHUDTutorial';
1919
import { CaptureMode } from '../../types';
2020
import { HUDButtons, HUDOverlay, OrientationEnforcer } from '../../components';
21+
import { PhotoCaptureHUDSightTutorial } from './PhotoCaptureHUDSightTutorial';
2122

2223
/**
2324
* Props of the PhotoCaptureHUD component.
@@ -31,6 +32,8 @@ export interface PhotoCaptureHUDProps
3132
| 'showCloseButton'
3233
| 'allowSkipTutorial'
3334
| 'enforceOrientation'
35+
| 'enableSightTutorial'
36+
| 'sightTutorial'
3437
> {
3538
/**
3639
* The inspection ID.
@@ -129,6 +132,14 @@ export interface PhotoCaptureHUDProps
129132
* Boolean indicating whether the sight guidelines should be displayed.
130133
*/
131134
showSightGuidelines: boolean;
135+
/**
136+
* Boolean indicating whether the sight tutorial should be displayed.
137+
*/
138+
showSightTutorial: boolean;
139+
/**
140+
* Callback called when the user clicks on the "help" button in PhotoCapture.
141+
*/
142+
toggleSightTutorial: () => void;
132143
}
133144

134145
/**
@@ -168,6 +179,10 @@ export function PhotoCaptureHUD({
168179
enforceOrientation,
169180
vehicleType,
170181
onDisableSightGuidelines,
182+
sightTutorial,
183+
enableSightTutorial,
184+
showSightTutorial,
185+
toggleSightTutorial,
171186
}: PhotoCaptureHUDProps) {
172187
const { t } = useTranslation();
173188
const [showCloseModal, setShowCloseModal] = useState(false);
@@ -214,6 +229,8 @@ export function PhotoCaptureHUD({
214229
tutorialStep={currentTutorialStep}
215230
vehicleType={vehicleType}
216231
onDisableSightGuidelines={onDisableSightGuidelines}
232+
enableSightTutorial={enableSightTutorial}
233+
toggleSightTutorial={toggleSightTutorial}
217234
/>
218235
</div>
219236
{mode !== CaptureMode.ADD_DAMAGE_PART_SELECT && (
@@ -255,6 +272,14 @@ export function PhotoCaptureHUD({
255272
sightId={selectedSight.id}
256273
sightGuidelines={sightGuidelines}
257274
addDamage={addDamage}
275+
toggleSightTutorial={toggleSightTutorial}
276+
/>
277+
<PhotoCaptureHUDSightTutorial
278+
show={showSightTutorial}
279+
sightTutorial={sightTutorial}
280+
selectedSight={selectedSight}
281+
onClose={toggleSightTutorial}
282+
enableSightTutorial={enableSightTutorial}
258283
/>
259284
<OrientationEnforcer orientation={enforceOrientation} />
260285
</div>

packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElements/PhotoCaptureHUDElements.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { CaptureMode } from '../../../types';
1515
* Props of the PhotoCaptureHUDElements component.
1616
*/
1717
export interface PhotoCaptureHUDElementsProps
18-
extends Pick<PhotoCaptureAppConfig, 'sightGuidelines' | 'addDamage'> {
18+
extends Pick<PhotoCaptureAppConfig, 'sightGuidelines' | 'addDamage' | 'enableSightTutorial'> {
1919
/**
2020
* The currently selected sight in the PhotoCapture component : the sight that the user needs to capture.
2121
*/
@@ -88,6 +88,10 @@ export interface PhotoCaptureHUDElementsProps
8888
* Boolean indicating whether the sight guidelines should be displayed.
8989
*/
9090
showSightGuidelines?: boolean;
91+
/**
92+
* Callback called when the user clicks on the "help" button in PhotoCapture.
93+
*/
94+
toggleSightTutorial?: () => void;
9195
}
9296

9397
/**
@@ -113,6 +117,8 @@ export function PhotoCaptureHUDElements(params: PhotoCaptureHUDElementsProps) {
113117
showSightGuidelines={params.showSightGuidelines}
114118
tutorialStep={params.tutorialStep}
115119
onDisableSightGuidelines={params.onDisableSightGuidelines}
120+
enableSightTutorial={params.enableSightTutorial}
121+
toggleSightTutorial={params.toggleSightTutorial}
116122
/>
117123
);
118124
}

packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/PhotoCaptureHUDElementsSight.styles.ts

+1
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ export const styles: Styles = {
3636
zIndex: 9,
3737
paddingBottom: '12px',
3838
},
39+
sightTutorialButton: { padding: '8px' },
3940
};

packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/PhotoCaptureHUDElementsSight.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { SightOverlay } from '@monkvision/common-ui-web';
2+
import { PhotoCaptureSightTutorialOption } from '@monkvision/types';
23
import { SightSlider } from './SightSlider';
34
import { styles } from './PhotoCaptureHUDElementsSight.styles';
45
import { AddDamageButton } from './AddDamageButton';
56
import { PhotoCaptureHUDElementsSightProps, usePhotoCaptureHUDSightPreviewStyle } from './hooks';
67
import { TutorialSteps } from '../../hooks';
78
import { SightGuideline } from './SightGuideline';
8-
import { Counter } from '../../../components';
9+
import { Counter, SightTutorialButton } from '../../../components';
910
import { CaptureMode } from '../../../types';
1011

1112
/**
@@ -26,6 +27,8 @@ export function PhotoCaptureHUDElementsSight({
2627
sightGuidelines,
2728
showSightGuidelines,
2829
tutorialStep,
30+
enableSightTutorial,
31+
toggleSightTutorial,
2932
}: PhotoCaptureHUDElementsSightProps) {
3033
const style = usePhotoCaptureHUDSightPreviewStyle({ previewDimensions });
3134

@@ -37,6 +40,9 @@ export function PhotoCaptureHUDElementsSight({
3740
{!tutorialStep && (
3841
<div style={style.elementsContainer}>
3942
<div style={style.top}>
43+
{enableSightTutorial !== PhotoCaptureSightTutorialOption.DISABLED && (
44+
<SightTutorialButton toggleSightTutorial={toggleSightTutorial} />
45+
)}
4046
<SightGuideline
4147
sightId={selectedSight.id}
4248
sightGuidelines={sightGuidelines}

packages/inspection-capture-web/src/PhotoCapture/PhotoCaptureHUD/PhotoCaptureHUDElementsSight/hooks.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { TutorialSteps } from '../../hooks';
88
* Props of the PhotoCaptureHUDElementsSight component.
99
*/
1010
export interface PhotoCaptureHUDElementsSightProps
11-
extends Pick<PhotoCaptureAppConfig, 'sightGuidelines' | 'addDamage'> {
11+
extends Pick<PhotoCaptureAppConfig, 'sightGuidelines' | 'addDamage' | 'enableSightTutorial'> {
1212
/**
1313
* The list of sights provided to the PhotoCapture component.
1414
*/
@@ -53,6 +53,10 @@ export interface PhotoCaptureHUDElementsSightProps
5353
* Boolean indicating whether the sight guidelines should be displayed.
5454
*/
5555
showSightGuidelines?: boolean;
56+
/**
57+
* Callback called when the user clicks on the "help" button in PhotoCapture.
58+
*/
59+
toggleSightTutorial?: () => void;
5660
}
5761

5862
export function usePhotoCaptureHUDSightPreviewStyle({

0 commit comments

Comments
 (0)