From 9bed4319f5ac211ebb1265f98ad5f643ce32a323 Mon Sep 17 00:00:00 2001 From: Samy Ouyahia <103439265+souyahia-monk@users.noreply.github.com> Date: Fri, 27 Sep 2024 08:19:37 +0200 Subject: [PATCH] Created HGV vehicle type (#852) --- .../VehicleTypeSelectionPage.tsx | 2 + .../components/Sights/SightCard/SightCard.tsx | 1 + .../components/VehicleTypeAsset/assets/hgv.ts | 2 + .../VehicleTypeAsset/assets/index.ts | 2 + packages/sights/package.json | 2 +- packages/sights/research/data/labels.json | 7 ++ .../sights/research/data/man12/man12.json | 66 +++++++++++++++++++ .../research/data/man12/man12.schema.json | 37 +++++++++++ .../data/man12/overlays/man12-2VHq5s6d.svg | 1 + .../data/man12/overlays/man12-AUlxkp6e.svg | 1 + .../data/man12/overlays/man12-E3yAloDS.svg | 1 + .../data/man12/overlays/man12-YIhu2ntW.svg | 1 + .../data/man12/overlays/man12-aOHkUnUo.svg | 1 + .../data/man12/overlays/man12-cjam9ZnA.svg | 1 + .../data/man12/overlays/man12-iNR6WXR_.svg | 1 + .../data/man12/overlays/man12-u8GNhGqe.svg | 1 + packages/sights/research/data/vehicles.json | 6 ++ .../sights/research/schemas/sight.schema.json | 27 +------- .../schemas/subschemas/vehicle.schema.json | 3 +- .../subschemas/vehicleType.schema.json | 13 +++- packages/sights/src/lib/data.ts | 3 + packages/types/src/sights.ts | 8 +++ 22 files changed, 158 insertions(+), 29 deletions(-) create mode 100644 packages/common-ui-web/src/components/VehicleTypeAsset/assets/hgv.ts create mode 100644 packages/sights/research/data/man12/man12.json create mode 100644 packages/sights/research/data/man12/man12.schema.json create mode 100644 packages/sights/research/data/man12/overlays/man12-2VHq5s6d.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-AUlxkp6e.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-E3yAloDS.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-YIhu2ntW.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-aOHkUnUo.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-cjam9ZnA.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-iNR6WXR_.svg create mode 100644 packages/sights/research/data/man12/overlays/man12-u8GNhGqe.svg diff --git a/apps/demo-app/src/pages/VehicleTypeSelectionPage/VehicleTypeSelectionPage.tsx b/apps/demo-app/src/pages/VehicleTypeSelectionPage/VehicleTypeSelectionPage.tsx index 90b2e8414..f0bb4fc60 100644 --- a/apps/demo-app/src/pages/VehicleTypeSelectionPage/VehicleTypeSelectionPage.tsx +++ b/apps/demo-app/src/pages/VehicleTypeSelectionPage/VehicleTypeSelectionPage.tsx @@ -2,6 +2,7 @@ import { useTranslation } from 'react-i18next'; import { Navigate } from 'react-router-dom'; import { VehicleTypeSelection } from '@monkvision/common-ui-web'; import { useMonkAppState } from '@monkvision/common'; +import { VehicleType } from '@monkvision/types'; import { Page } from '../pages'; export function VehicleTypeSelectionPage() { @@ -20,6 +21,7 @@ export function VehicleTypeSelectionPage() { authToken={authToken ?? ''} apiDomain={config.apiDomain} thumbnailDomain={config.thumbnailDomain} + availableVehicleTypes={[VehicleType.HGV]} // TODO : Remove this line /> ); } diff --git a/documentation/src/components/Sights/SightCard/SightCard.tsx b/documentation/src/components/Sights/SightCard/SightCard.tsx index b70e21f24..3cb2d0a3d 100644 --- a/documentation/src/components/Sights/SightCard/SightCard.tsx +++ b/documentation/src/components/Sights/SightCard/SightCard.tsx @@ -17,6 +17,7 @@ const vehicleModelDisplayOverlays: Record = { [VehicleType.HATCHBACK]: VehicleTypeHatchbackAsset, @@ -19,4 +20,5 @@ export const VehicleTypeAssetsMap: Record = { [VehicleType.LARGE_SUV]: VehicleTypeLargeSuvAsset, [VehicleType.MINIVAN]: VehicleTypeMinivanAsset, [VehicleType.SUV]: VehicleTypeSuvAsset, + [VehicleType.HGV]: VehicleTypeHGVAsset, }; diff --git a/packages/sights/package.json b/packages/sights/package.json index 88349f31d..bca26ec1d 100644 --- a/packages/sights/package.json +++ b/packages/sights/package.json @@ -30,7 +30,7 @@ "eslint": "eslint --format=pretty ./src ./test", "eslint:fix": "eslint --fix --format=pretty ./src ./test", "lint": "yarn run prettier && yarn run eslint", - "lint:fix": "yarn run prettier:fix && yarn run eslint:fix && yarn run svgo" + "lint:fix": "yarn run prettier:fix && yarn run eslint:fix && echo \"Running SVGO on package overlays...\" && yarn run svgo" }, "dependencies": { "@monkvision/types": "4.0.19" diff --git a/packages/sights/research/data/labels.json b/packages/sights/research/data/labels.json index a8a68b7eb..acd4a0d56 100644 --- a/packages/sights/research/data/labels.json +++ b/packages/sights/research/data/labels.json @@ -552,6 +552,13 @@ "de": "Geländewagen", "nl": "SUV" }, + "hgv": { + "key": "hgv", + "en": "HGV", + "fr": "HGV", + "de": "HGV", + "nl": "HGV" + }, "tire": { "key": "tire", "en": "Tire", diff --git a/packages/sights/research/data/man12/man12.json b/packages/sights/research/data/man12/man12.json new file mode 100644 index 000000000..6975e7de5 --- /dev/null +++ b/packages/sights/research/data/man12/man12.json @@ -0,0 +1,66 @@ +{ + "man12-2VHq5s6d": { + "id": "man12-2VHq5s6d", + "category": "exterior", + "label": "rear-right", + "overlay": "man12-2VHq5s6d.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-aOHkUnUo": { + "id": "man12-aOHkUnUo", + "category": "exterior", + "label": "rear-left", + "overlay": "man12-aOHkUnUo.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-AUlxkp6e": { + "id": "man12-AUlxkp6e", + "category": "exterior", + "label": "front-low", + "overlay": "man12-AUlxkp6e.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-cjam9ZnA": { + "id": "man12-cjam9ZnA", + "category": "exterior", + "label": "lateral-full-right", + "overlay": "man12-cjam9ZnA.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-E3yAloDS": { + "id": "man12-E3yAloDS", + "category": "exterior", + "label": "rear-low", + "overlay": "man12-E3yAloDS.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-iNR6WXR_": { + "id": "man12-iNR6WXR_", + "category": "exterior", + "label": "lateral-full-left", + "overlay": "man12-iNR6WXR_.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-u8GNhGqe": { + "id": "man12-u8GNhGqe", + "category": "exterior", + "label": "front-fender-left", + "overlay": "man12-u8GNhGqe.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + }, + "man12-YIhu2ntW": { + "id": "man12-YIhu2ntW", + "category": "exterior", + "label": "front-fender-right", + "overlay": "man12-YIhu2ntW.svg", + "vehicle": "man12", + "tasks": ["damage_detection"] + } +} diff --git a/packages/sights/research/data/man12/man12.schema.json b/packages/sights/research/data/man12/man12.schema.json new file mode 100644 index 000000000..3dc12d4c9 --- /dev/null +++ b/packages/sights/research/data/man12/man12.schema.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "man12.schema", + "definitions": { + "Sight": { + "$ref": "sight.schema" + } + }, + "type": "object", + "propertyNames": { + "type": "string", + "pattern": "man12-[a-zA-Z\\d_-]+" + }, + "patternProperties": { + "": { + "allOf": [ + { + "$ref": "#/definitions/Sight" + } + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "pattern": "^man12-[a-zA-Z\\d_-]+$" + }, + "mirror_sight": { + "type": "string", + "pattern": "^man12-[a-zA-Z\\d_-]+$" + } + }, + "required": ["id"], + "unevaluatedProperties": false + } + }, + "unevaluatedProperties": false +} diff --git a/packages/sights/research/data/man12/overlays/man12-2VHq5s6d.svg b/packages/sights/research/data/man12/overlays/man12-2VHq5s6d.svg new file mode 100644 index 000000000..6cf041d16 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-2VHq5s6d.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-AUlxkp6e.svg b/packages/sights/research/data/man12/overlays/man12-AUlxkp6e.svg new file mode 100644 index 000000000..8aa5478e7 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-AUlxkp6e.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-E3yAloDS.svg b/packages/sights/research/data/man12/overlays/man12-E3yAloDS.svg new file mode 100644 index 000000000..8f67a7ff8 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-E3yAloDS.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-YIhu2ntW.svg b/packages/sights/research/data/man12/overlays/man12-YIhu2ntW.svg new file mode 100644 index 000000000..c2257cbd8 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-YIhu2ntW.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-aOHkUnUo.svg b/packages/sights/research/data/man12/overlays/man12-aOHkUnUo.svg new file mode 100644 index 000000000..f8dd22832 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-aOHkUnUo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-cjam9ZnA.svg b/packages/sights/research/data/man12/overlays/man12-cjam9ZnA.svg new file mode 100644 index 000000000..28e22855d --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-cjam9ZnA.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-iNR6WXR_.svg b/packages/sights/research/data/man12/overlays/man12-iNR6WXR_.svg new file mode 100644 index 000000000..d3e04177d --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-iNR6WXR_.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/man12/overlays/man12-u8GNhGqe.svg b/packages/sights/research/data/man12/overlays/man12-u8GNhGqe.svg new file mode 100644 index 000000000..e0a4fde72 --- /dev/null +++ b/packages/sights/research/data/man12/overlays/man12-u8GNhGqe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/packages/sights/research/data/vehicles.json b/packages/sights/research/data/vehicles.json index 7c86d69cc..8a7280165 100644 --- a/packages/sights/research/data/vehicles.json +++ b/packages/sights/research/data/vehicles.json @@ -59,5 +59,11 @@ "make": "Volkswagen", "model": "T-Roc", "type": "suv" + }, + "man12": { + "id": "man12", + "make": "MAN", + "model": "TGL 12.250", + "type": "hgv" } } diff --git a/packages/sights/research/schemas/sight.schema.json b/packages/sights/research/schemas/sight.schema.json index 8da0f1fd8..10ac6e52c 100644 --- a/packages/sights/research/schemas/sight.schema.json +++ b/packages/sights/research/schemas/sight.schema.json @@ -45,30 +45,5 @@ "$ref": "#/definitions/Task" } }, - "required": ["category", "label", "overlay", "vehicle", "tasks"], - "allOf": [ - { - "if": { - "properties": { - "dev": { - "anyOf": [ - { - "const": null - }, - { - "const": false - } - ] - }, - "category": { - "const": "exterior" - } - }, - "required": ["category"] - }, - "then": { - "required": ["camera"] - } - } - ] + "required": ["category", "label", "overlay", "vehicle", "tasks"] } diff --git a/packages/sights/research/schemas/subschemas/vehicle.schema.json b/packages/sights/research/schemas/subschemas/vehicle.schema.json index 4ed763633..48e79014f 100644 --- a/packages/sights/research/schemas/subschemas/vehicle.schema.json +++ b/packages/sights/research/schemas/subschemas/vehicle.schema.json @@ -12,6 +12,7 @@ "haccord", "jgc21", "tsienna20", - "vwtroc" + "vwtroc", + "man12" ] } diff --git a/packages/sights/research/schemas/subschemas/vehicleType.schema.json b/packages/sights/research/schemas/subschemas/vehicleType.schema.json index e1468ce57..1036578f1 100644 --- a/packages/sights/research/schemas/subschemas/vehicleType.schema.json +++ b/packages/sights/research/schemas/subschemas/vehicleType.schema.json @@ -2,5 +2,16 @@ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "subschemas/vehicleType.schema", "type": "string", - "enum": ["hatchback", "cuv", "pickup", "city", "van", "sedan", "large-suv", "minivan", "suv"] + "enum": [ + "hatchback", + "cuv", + "pickup", + "city", + "van", + "sedan", + "large-suv", + "minivan", + "suv", + "hgv" + ] } diff --git a/packages/sights/src/lib/data.ts b/packages/sights/src/lib/data.ts index d358d52c9..8f936a5ae 100644 --- a/packages/sights/src/lib/data.ts +++ b/packages/sights/src/lib/data.ts @@ -30,6 +30,8 @@ import jgc21SightsJSON from './data/sights/jgc21.json'; import tsienna20SightsJSON from './data/sights/tsienna20.json'; // @ts-ignore import vwtrocSightsJSON from './data/sights/vwtroc.json'; +// @ts-ignore +import man12SightsJSON from './data/sights/man12.json'; /** * Object map associating translation keys to sight labels translations. @@ -55,6 +57,7 @@ const sights = { ...jgc21SightsJSON, ...tsienna20SightsJSON, ...vwtrocSightsJSON, + ...man12SightsJSON, } as SightDictionary; /** diff --git a/packages/types/src/sights.ts b/packages/types/src/sights.ts index 5876c4b92..f73956619 100644 --- a/packages/types/src/sights.ts +++ b/packages/types/src/sights.ts @@ -66,6 +66,10 @@ export enum VehicleType { * thanks to a typical 4x4 capability. */ SUV = 'suv', + /** + * Huge transportation trucks. + */ + HGV = 'hgv', } /** @@ -112,6 +116,10 @@ export enum VehicleModel { * Volkswagen T-Roc (SUV) */ VWTROC = 'vwtroc', + /** + * Man 12 (HGV) + */ + MAN12 = 'man12', } /**