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(qr-scanner): implement scanner feature in dashboard and compare view #64

Merged
merged 19 commits into from
Aug 22, 2024

Conversation

JonathanXITASO
Copy link
Contributor

@JonathanXITASO JonathanXITASO commented Aug 16, 2024

Description

new component:
Clicking on the QR scanner logo will open the camera.
It will continuously scan for a qr code and execute the onScan callback if a valid one was found:

  • Dashboard: Will open the page with the specific ID
  • Compare: Will add the AAS to the compare list

image
image
image

Fixes # (MNES-1175)

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix or my feature works
  • New and existing tests pass locally with my changes
  • My changes contain no console logs

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 edited this file and now it will be centered and fill the entire parent component.
The respective lengths in the logo are also symmetric now :)

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 component is a replacement for the ManualAasAddInput and ManualAasViewerInput by giving it the callback and defining it outside
This has the additional benefit of beeing able to reuse the callback in the scanner component as well.

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 Error is used, if the error should be printed to the user (by Snackbar for example).
Any ideas on this? Is this the correct way to handle this case or should it be a more generic 'just add a localizedErrorDescriptor variable to the object'

src/lib/searchUtilActions/search.ts Outdated Show resolved Hide resolved
Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

@@ -50,6 +54,33 @@ export function CompareView() {
const handleDeleteAas = (aasId: string) => {
deleteAas(aasId);
};

const handleAddAas = async (aasId: string) => {
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 logic was previously in ManualAasAddInput.tsx.
This should be more readable

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 component will handle all the logic of switching the views and call the onScan callback on a valid QR code.

src/app/[locale]/_components/QrScanner.tsx Show resolved Hide resolved
@JonathanXITASO JonathanXITASO changed the base branch from dev to feat(qr-scanner) August 16, 2024 13:51
@JonathanXITASO JonathanXITASO marked this pull request as ready for review August 16, 2024 13:51
src/app/[locale]/_components/QrScanner.tsx Outdated Show resolved Hide resolved
src/app/[locale]/_components/QrScanner.tsx Outdated Show resolved Hide resolved
src/lib/searchUtilActions/search.ts Outdated Show resolved Hide resolved
@JonathanXITASO JonathanXITASO self-assigned this Aug 22, 2024
@JonathanXITASO JonathanXITASO merged commit af44c2a into feat(qr-scanner) Aug 22, 2024
2 checks passed
@JonathanXITASO JonathanXITASO deleted the MNES-1171_Implement-Scanner-feature branch August 22, 2024 07:28
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.

5 participants