Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/mn 569/add damage part select #829

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

arunachalam-monk
Copy link
Contributor

@arunachalam-monk arunachalam-monk commented Aug 30, 2024

Overview

Jira Ticket Reference : MN-569

Checklist before requesting a review

  • I have updated the unit tests based on the changes I made
  • I have updated the docs (TSDoc / README / global doc) to reflect my changes
  • I have updated the local app configs if needed
  • I have performed self-QA of my feature by testing the apps and packages and made sure that :
    • No regression or new bug has occurred
    • The acceptance criteria listed in the ticket are met
    • Self-QA was made on both desktop and mobile

@@ -2,7 +2,7 @@
"id": "demo-app-dev",
"description": "Config for the dev Demo App.",
"allowSkipRetake": true,
"enableAddDamage": true,
"addDamage": "two_shot",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to part_select by default on all apps

@@ -2,7 +2,7 @@
"id": "drive-app-preview",
"description": "Config for the preview Drive App.",
"allowSkipRetake": true,
"enableAddDamage": false,
"addDamage": "two_shot",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to part_select by default on all apps

@@ -1,6 +1,6 @@
{
"allowSkipRetake": true,
"enableAddDamage": false,
"addDamage": "two_shot",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to part_select by default on all apps

@@ -1,6 +1,6 @@
{
"allowSkipRetake": true,
"enableAddDamage": true,
"addDamage": "two_shot",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

switch to part_select by default on all apps

'@monkvision/eslint-config-base',
'plugin:@typescript-eslint/recommended',
'plugin:import/typescript',
"@monkvision/eslint-config-base",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your IDE probably modified the punctuation on this file by mistake. Go back to single quotes on the file.

Comment on lines +70 to +73
if (vehicleType === VehicleType.SUV) {
// eslint-disable-next-line no-param-reassign
vehicleType = VehicleType.CUV;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this :

cons type = vehicleType === VehicleType.SUV ? VehicleType.CUV : vehicleType;

over this :

if (vehicleType === VehicleType.SUV) {
  // eslint-disable-next-line no-param-reassign
  vehicleType = VehicleType.CUV;
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be string forward and don't need to create a new variable. because vehicleType is good variable name.

@@ -164,7 +164,7 @@ describe('InspectionGalleryItemCard component', () => {
const { unmount } = render(<InspectionGalleryItemCard {...props} />);

expect(useInspectionGalleryItemStatusIconName).toHaveBeenCalled();
expectPropsOnChildMock(Icon, { icon: useInspectionGalleryItemStatusIconName({} as any) });
expectPropsOnChildMock(Icon, { icon: useInspectionGalleryItemStatusIconName({} as any)! });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even in tests, I really don't like using !, try to find a better solution

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this, we need to specify the exact type using the 'as' keyword to inform TypeScript about a different type But that also have it downsights.

{ allow: ["arrowFunctions"] },
],
"@typescript-eslint/no-empty-interface": OFF,
"@typescript-eslint/no-non-null-assertion": OFF,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this rule : it should stay enabled

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have few clarification on this.

@@ -129,7 +130,7 @@ export function PhotoCapture({
customComplianceThresholdsPerSight,
useLiveCompliance = false,
allowSkipRetake = false,
enableAddDamage = true,
addDamage = AddDamage.TWO_SHOT,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default should be part select

/**
* The current state of the Add Damage mode of part selection.
*/
addDamagePartSelectState: 'part-select' | 'image-capture';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use an enum instead of magic strings for 'part-select' and 'image-capture'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change had been removed.


/**
* Components implementing the main buttons of the PhotoCapture Camera HUD. This component implements 3 buttons :
* - A take picture button
* - A gallery button
* - A close button (only displayed if the `onClose` callback is defined)
* - A action button (only displayed if the `onAction` callback is defined)
Copy link
Contributor

@souyahia-monk souyahia-monk Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...An action button...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change had been removed. Previous iteration required to keep the approve aka validate key on the right side above capture icon. where commonly close icon is present.

> & {
onCancel: PhotoCaptureHUDElementsProps['onCancelAddDamage'];
partSelectState: PhotoCaptureHUDElementsProps['addDamagePartSelectState'];
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line under this

import { PhotoCaptureHUDElementsProps } from '../PhotoCaptureHUDElements/PhotoCaptureHUDElements.model';
import { usePhotoCaptureHUDElementsAddPartSelectShotStyle } from './usePhotoCaptureHUDElementsAddPartSelectShotStyle';

type PhotoCaptureHUDElementsAddPartSelectShotProps = Pick<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export this type

const [selectedParts, setSelectedParts] = useState<VehiclePart[]>([]);
const { i18n, t } = useTranslation();
const style = usePhotoCaptureHUDElementsAddPartSelectShotStyle();
useEffect(() => onAddDamageParts(selectedParts), [selectedParts]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank lines above and under this hook

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this effect is removed.

Comment on lines 27 to 39
if (partSelectState === 'image-capture') {
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank lines above and under this if statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is removed

>
{t('photo.hud.addDamage.selectParts')}
</div>
<VehiclePartSelection vehicleType={vehicleType!} onPartsSelected={setSelectedParts} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use ! : find another solution

| 'wrapper',
CSSProperties
> {
const { palette } = useMonkTheme();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blank line under this

@@ -60,7 +60,7 @@ export function PhotoCaptureHUDTutorial({
sightId={sightId}
sightGuidelines={sightGuidelines}
enableSightGuidelines={currentTutorialStep === TutorialSteps.GUIDELINE}
enableAddDamage={true}
addDamage={AddDamage.TWO_SHOT}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of passing AddDamage.TWO_SHOT to the addDamage prop, pass the real prop obtained from the PhotoCapture component

tasks: tasksBySight?.[sightState.selectedSight.id] ?? sightState.selectedSight.tasks,
});
break;
case PhotoCaptureMode.ADD_DAMAGE_PART_SELECT:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this switch case above the SIGHT case to make it next to the other add damage cases

@@ -17,7 +17,8 @@
"damagedPartCounter": "1 / 2 • Damaged part",
"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"
"infoCloseup": "Take a closeup picture of the damage",
"selectParts": "Select the parts where you damage is"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...where the damage is...

@@ -17,7 +17,8 @@
"damagedPartCounter": "1 / 2 • Pièce endommagée",
"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"
"infoCloseup": "Prendre une photo en gros plan du dégât",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Veuillez prendre une photo en gros plan du dégât"

@@ -17,7 +17,8 @@
"damagedPartCounter": "1 / 2 • Pièce endommagée",
"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"
"infoCloseup": "Prendre une photo en gros plan du dégât",
"selectParts": "Sélectionnez les pièces où vous endommagez"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Veuillez sélectionner les pièces endommagées

Comment on lines 211 to 214
en: `Damage on ${partsTranslation.map((part) => part.en).join(', ')}`,
fr: `Dommages sur ${partsTranslation.map((part) => part.en).join(', ')}`,
de: `Schaden an ${partsTranslation.map((part) => part.en).join(', ')}`,
nl: `Schade aan ${partsTranslation.map((part) => part.en).join(', ')}`,
Copy link
Contributor

@souyahia-monk souyahia-monk Sep 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change french label to "Dégât sur ..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants