Skip to content

Commit 291bd38

Browse files
authored
Added DamageDisclosure feature (#898)
* Added new images post options: PART_SELECT && TWO_SHOT * Added 'VehicleDynamicWireframe' component * Added 'VehiclePartSelection' component * Added 'CaptureSelection' component * Enabled gallery to hide Sight pictures * Shared components between `PhotoCapture' and 'DamageDisclosure' * Shared hooks logic between 'PhotoCapture' and 'DamageDisclosure' * Added 'part_select' addDamage feature + fixed import from common hooks and components * Added 'DamageDisclosure' component * Added CaptureSelectionPage & DamageDisclosure in `demo-app` * Docs + improve function/const naming * Fixed conflits with VideoCapture feature
1 parent b806e4d commit 291bd38

File tree

154 files changed

+4130
-977
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+4130
-977
lines changed

apps/demo-app/src/components/AppRouter.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import {
88
VehicleTypeSelectionPage,
99
} from '../pages';
1010
import { App } from './App';
11+
import { CaptureSelectionPage } from '../pages/CaptureSelectionPage';
12+
import { DamageDisclosurePage } from '../pages/DamageDisclosurePage';
1113

1214
export function AppRouter() {
1315
return (
@@ -34,6 +36,15 @@ export function AppRouter() {
3436
}
3537
index
3638
/>
39+
<Route
40+
path={Page.CAPTURE_SELECTION}
41+
element={
42+
<AuthGuard redirectTo={Page.LOG_IN}>
43+
<CaptureSelectionPage />
44+
</AuthGuard>
45+
}
46+
index
47+
/>
3748
<Route
3849
path={Page.PHOTO_CAPTURE}
3950
element={
@@ -43,6 +54,15 @@ export function AppRouter() {
4354
}
4455
index
4556
/>
57+
<Route
58+
path={Page.DAMAGE_DISCLOSURE}
59+
element={
60+
<AuthGuard redirectTo={Page.LOG_IN}>
61+
<DamageDisclosurePage />
62+
</AuthGuard>
63+
}
64+
index
65+
/>
4666
<Route path='*' element={<Navigate to={Page.CREATE_INSPECTION} />} />
4767
</Route>
4868
</Routes>

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Config for the local Demo App.",
44
"workflow": "photo",
55
"allowSkipRetake": true,
6-
"enableAddDamage": true,
6+
"addDamage": "part_select",
77
"enableSightGuidelines": true,
88
"allowVehicleTypeSelection": true,
99
"allowManualLogin": true,
@@ -15,6 +15,7 @@
1515
"apiDomain": "api.preview.monk.ai/v1",
1616
"thumbnailDomain": "europe-west1-monk-preview-321715.cloudfunctions.net/image_resize",
1717
"enableSightTutorial": false,
18+
"enableTutorial": "first_time_only",
1819
"startTasksOnComplete": true,
1920
"showCloseButton": false,
2021
"enforceOrientation": "landscape",

apps/demo-app/src/pages/CaptureSelectionPage/CaptureSelectionPage.module.css

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { CaptureSelection } from '@monkvision/common-ui-web';
2+
import { useNavigate } from 'react-router-dom';
3+
import { useTranslation } from 'react-i18next';
4+
import { Page } from '../pages';
5+
6+
export function CaptureSelectionPage() {
7+
const navigate = useNavigate();
8+
const { i18n } = useTranslation();
9+
10+
return (
11+
<CaptureSelection
12+
lang={i18n.language}
13+
onCapture={() => navigate(Page.PHOTO_CAPTURE)}
14+
onAddDamage={() => navigate(Page.DAMAGE_DISCLOSURE)}
15+
/>
16+
);
17+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './CaptureSelectionPage';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.container {
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useTranslation } from 'react-i18next';
2+
import { useMonkAppState } from '@monkvision/common';
3+
import { DamageDisclosure } from '@monkvision/inspection-capture-web';
4+
import { useNavigate } from 'react-router-dom';
5+
import { CaptureWorkflow, VehicleType } from '@monkvision/types';
6+
import styles from './DamageDisclosurePage.module.css';
7+
import { Page } from '../pages';
8+
9+
export function DamageDisclosurePage() {
10+
const navigate = useNavigate();
11+
const { i18n } = useTranslation();
12+
const { config, authToken, inspectionId, vehicleType } = useMonkAppState({
13+
requireInspection: true,
14+
requireWorkflow: CaptureWorkflow.PHOTO,
15+
});
16+
17+
return (
18+
<div className={styles['container']}>
19+
<DamageDisclosure
20+
{...config}
21+
apiConfig={{
22+
authToken,
23+
apiDomain: config.apiDomain,
24+
thumbnailDomain: config.thumbnailDomain,
25+
}}
26+
inspectionId={inspectionId}
27+
onComplete={() => navigate(Page.PHOTO_CAPTURE)}
28+
lang={i18n.language}
29+
vehicleType={vehicleType ?? VehicleType.SEDAN}
30+
/>
31+
</div>
32+
);
33+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './DamageDisclosurePage';

apps/demo-app/src/pages/PhotoCapturePage/PhotoCapturePage.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
22
import { useTranslation } from 'react-i18next';
33
import { useMonkAppState } from '@monkvision/common';
44
import { PhotoCapture } from '@monkvision/inspection-capture-web';
5-
import { CaptureWorkflow } from '@monkvision/types';
5+
import { CaptureWorkflow, VehicleType } from '@monkvision/types';
66
import styles from './PhotoCapturePage.module.css';
77
import { createInspectionReportLink } from './inspectionReport';
88

@@ -36,6 +36,7 @@ export function PhotoCapturePage() {
3636
sights={currentSights}
3737
onComplete={handleComplete}
3838
lang={i18n.language}
39+
vehicleType={vehicleType ?? VehicleType.SEDAN}
3940
/>
4041
</div>
4142
);

apps/demo-app/src/pages/VehicleTypeSelectionPage/VehicleTypeSelectionPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export function VehicleTypeSelectionPage() {
1212
const { i18n } = useTranslation();
1313

1414
if (vehicleType || !config.allowVehicleTypeSelection) {
15-
return <Navigate to={Page.PHOTO_CAPTURE} replace />;
15+
return <Navigate to={Page.CAPTURE_SELECTION} replace />;
1616
}
1717

1818
return (

0 commit comments

Comments
 (0)