Skip to content
This repository was archived by the owner on Jun 8, 2026. It is now read-only.

Commit a5ca027

Browse files
committed
Merge branch 'main' of https://github.com/monkvision/monkjs
2 parents 3136886 + e689bc5 commit a5ca027

18 files changed

Lines changed: 59 additions & 49 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "monk",
3-
"version": "3.8.5",
3+
"version": "3.8.6",
44
"author": "monkvision",
55
"license": "BSD-3-Clause-Clear",
66
"private": true,

packages/camera/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@monkvision/camera",
33
"author": "monkvision",
44
"license": "BSD-3-Clause-Clear",
5-
"version": "3.8.5",
5+
"version": "3.8.6",
66
"private": false,
77
"description": "AI-powered vehicle damage detection for React Native",
88
"homepage": "https://github.com/monkvision/monkjs/packages/camera/#readme",
@@ -70,10 +70,10 @@
7070
"release-it": "*"
7171
},
7272
"peerDependencies": {
73-
"@monkvision/corejs": "3.8.5",
74-
"@monkvision/inspection-report": "3.8.5",
75-
"@monkvision/sights": "3.8.5",
76-
"@monkvision/toolkit": "3.8.5",
73+
"@monkvision/corejs": "3.8.6",
74+
"@monkvision/inspection-report": "3.8.6",
75+
"@monkvision/sights": "3.8.6",
76+
"@monkvision/toolkit": "3.8.6",
7777
"expo-camera": "^12.3.0",
7878
"react": "*",
7979
"react-native": "*",

packages/camera/src/components/Capture/hooks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ export function useUploadAdditionalDamage({ inspectionId, addDamageParts, onPict
444444
export function useCheckComplianceAsync({
445445
compliance, inspectionId, sightId: currentSighId,
446446
}) {
447-
return useCallback(async (imageId, customSightId) => {
447+
return useCallback(async (imageId, customSightId, increment = false) => {
448448
const { dispatch } = compliance;
449449
const sightId = customSightId || currentSighId;
450450

@@ -455,7 +455,7 @@ export function useCheckComplianceAsync({
455455
try {
456456
dispatch({
457457
type: Actions.compliance.UPDATE_COMPLIANCE,
458-
increment: true,
458+
increment,
459459
payload: { id: sightId, status: 'pending', imageId },
460460
});
461461

packages/camera/src/components/UploadCenter/UploadCard/hooks/useSubtitle.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import { useMemo } from 'react';
22
import { useTranslation } from 'react-i18next';
33

44
const translatedErrorCodes = [
5+
'NO_CAR_BODY',
6+
'BLURRINESS',
7+
'UNDEREXPOSURE',
8+
'OVEREXPOSURE',
59
'TOO_ZOOMED',
610
'NOT_ZOOMED_ENOUGH',
711
'WRONG_ANGLE',
@@ -13,6 +17,19 @@ const translatedErrorCodes = [
1317
'INTERIOR_NOT_SUPPORTED',
1418
];
1519

20+
function getSubtitle(reasons, t) {
21+
if (reasons.length === 0) {
22+
return t('uploadCenter.subtitle.unknown');
23+
}
24+
const translatedReasons = reasons.map((reason) => {
25+
const key = translatedErrorCodes
26+
.find((errorCode) => reason.toUpperCase().startsWith(errorCode));
27+
return key ? t(`uploadCenter.subtitle.reasons.${key}`) : `[MISSING TRANSLATION : ${reason}]`;
28+
});
29+
const joinedReasons = translatedReasons.join(`${t('uploadCenter.subtitle.reasonsJoin')} `);
30+
return `${t('uploadCenter.subtitle.reasonsStart')} ${joinedReasons}`;
31+
}
32+
1633
export default function useSubtitle({
1734
isComplianceUnknown,
1835
isComplianceIdle,
@@ -40,31 +57,14 @@ export default function useSubtitle({
4057
const reasons = [];
4158

4259
if (badQuality && iqa.reasons) {
43-
iqa.reasons.forEach((reason, index) => {
44-
const errorCode = translatedErrorCodes.find((code) => reason.startsWith(code));
45-
if (errorCode && errorCode !== 'UNKNOWN_SIGHT') {
46-
const first = index === 0;
47-
reasons.push(first ? t(`uploadCenter.subtitle.reasons.${reason}`)
48-
: `${t('uploadCenter.subtitle.reasonsJoin')} ${t(`uploadCenter.subtitle.reasons.${reason}`)}`);
49-
}
50-
});
60+
reasons.push(...iqa.reasons);
5161
}
5262

5363
if (badCoverage && carCov.reasons) {
54-
carCov.reasons.forEach((reason, index) => {
55-
const first = index === 0 && !badQuality;
56-
const errorCode = translatedErrorCodes.find((code) => reason.startsWith(code));
57-
// display all reasons expect `UNKNOWN_SIGHT`
58-
if (errorCode && errorCode !== 'UNKNOWN_SIGHT') {
59-
reasons.push(first ? t(`uploadCenter.subtitle.reasons.${errorCode}`)
60-
: `${t('uploadCenter.subtitle.reasonsJoin')} ${t(`uploadCenter.subtitle.reasons.${errorCode}`)}`);
61-
}
62-
});
64+
reasons.push(...carCov.reasons);
6365
}
6466

65-
if (reasons.length > 0) {
66-
return `${t('uploadCenter.subtitle.reasonsStart')} ${reasons.join(' ')}`;
67-
}
67+
return getSubtitle(reasons, t);
6868
}
6969

7070
return t('uploadCenter.subtitle.queueBlocked');

packages/camera/src/components/UploadCenter/hooks/allowedComplianceReasons.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
const ALLOWED_COMPLIANCE_REASONS = [
2+
'NO_CAR_BODY',
23
'LOW_RESOLUTION',
34
'BLURRINESS',
45
'UNDEREXPOSURE',
@@ -16,7 +17,7 @@ export default function filterUnwantedComplianceReasons(reasons) {
1617
}
1718
return reasons.filter(
1819
(reason) => ALLOWED_COMPLIANCE_REASONS
19-
.findIndex((allowedReason) => reason.startsWith(allowedReason)) !== -1,
20+
.findIndex((allowedReason) => reason.toUpperCase().startsWith(allowedReason)) !== -1,
2021
);
2122
}
2223

@@ -35,6 +36,7 @@ export default function filterUnwantedComplianceReasons(reasons) {
3536
* REFLECTIONS
3637
* UNKNOWN_SIGHT
3738
* UNKNOWN_VIEWPOINT
39+
* NO_CAR_BODY
3840
* NO_VEHICLE
3941
* WRONG_ANGLE
4042
* WRONG_CENTER_PART

packages/camera/src/components/UploadCenter/hooks/useComplianceIds.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,17 @@ export default function useComplianceIds({
3535
const handleChangeReasons = (compliances) => ({
3636
...item,
3737
requestCount,
38-
result: { ...result,
38+
result: {
39+
...result,
3940
data: {
40-
...result.data, compliances: { ...result.data.compliances, ...compliances } } } });
41+
...result.data,
42+
compliances: {
43+
...result.data.compliances,
44+
...compliances,
45+
},
46+
},
47+
},
48+
});
4149

4250
const hasReachedMaxRetries = requestCount >= 2;
4351

packages/camera/src/components/UploadCenter/hooks/useHandlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function useHandlers({
7070
// double check if the compliance is not invalid
7171
const hasTodoCompliances = Object.values(compliances).some((c) => hasTodo(c));
7272
if (!hasTodoCompliances) { return; }
73-
setTimeout(async () => { await checkComplianceAsync(pictureId, currentId); }, 500);
73+
setTimeout(async () => { await checkComplianceAsync(pictureId, currentId, true); }, 500);
7474
}, [compliance.state]);
7575

7676
const handleRecheck = useCallback((id) => {

packages/camera/src/i18n/resources/en.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ const en = {
3838
reasonsStart: 'This image',
3939
reasonsJoin: 'and',
4040
reasons: {
41-
blurriness: 'is blurry',
42-
underexposure: 'is underexposed (too dark)',
43-
overexposure: 'is overexposed (too bright)',
41+
BLURRINESS: 'is blurry',
42+
UNDEREXPOSURE: 'is underexposed (too dark)',
43+
OVEREXPOSURE: 'is overexposed (too bright)',
4444
TOO_ZOOMED: 'is too zoomed',
4545
NOT_ZOOMED_ENOUGH: 'is too far from vehicle',
4646
WRONG_ANGLE: 'is taken from incorrect angle',

packages/camera/src/i18n/resources/fr.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ const fr = {
3838
reasonsStart: 'Cette image',
3939
reasonsJoin: 'et',
4040
reasons: {
41-
blurriness: 'est floue',
42-
underexposure: 'est sous-exposée (trop sombre)',
43-
overexposure: 'est sur-exposée (trop lumineuse)',
41+
BLURRINESS: 'est floue',
42+
UNDEREXPOSURE: 'est sous-exposée (trop sombre)',
43+
OVEREXPOSURE: 'est sur-exposée (trop lumineuse)',
4444
TOO_ZOOMED: 'est trop zoomée',
4545
NOT_ZOOMED_ENOUGH: 'est trop loin du véhicule',
4646
WRONG_ANGLE: 'est prise depuis un angle incorrect',

packages/corejs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@monkvision/corejs",
33
"author": "monkvision",
44
"license": "BSD-3-Clause-Clear",
5-
"version": "3.8.5",
5+
"version": "3.8.6",
66
"private": false,
77
"description": "AI-powered vehicle damage detection for JavaScript",
88
"homepage": "https://github.com/monkvision/monkjs/packages/corejs/#readme",

0 commit comments

Comments
 (0)