From 047350febd7118669b433e953da97ed1e507fcae Mon Sep 17 00:00:00 2001 From: lukasbicus Date: Thu, 31 Oct 2024 11:42:10 +0100 Subject: [PATCH] Add scanning (#9) * Update plan * Fix same key error * Add a dialog * Add naive scanning. * Add naive code handling. * Replace codeType by codeFormat. * Fix ts warning, make card code input disabled by default. * Adjust scanner * Add explanation text. * Exclude .next from tests. * Make layout responsive. * Create scannerReducer * Use scannerReducer * Move scanner reducer to create-card-form * Cleanup * Adjust names. * Cleanup in scanner * Display toggle button conditionally. * Disable strict mode test. * Set device id directly * Comment constrains * Enable strict mode * Cleanup. * Increase required devices count for switch. * Cleanup * Update reducer. * Use isModalVisible * Adjust reducer names. --- app/(homescreens)/my-cards/my-cards.tsx | 2 +- app/create-card/create-card-form.tsx | 302 ++++++++++++------ app/create-card/createCardFormReducer.spec.ts | 80 +++++ app/create-card/createCardFormReducer.ts | 70 ++++ app/create-card/scanner.tsx | 127 ++++++++ app/layout.tsx | 9 +- app/lib/app-state/reducer.spec.ts | 7 +- app/lib/app-state/reducer.ts | 5 +- app/lib/predefined-companies.ts | 29 +- app/lib/shared.ts | 5 - app/ui/text-field.tsx | 3 + next.config.mjs | 4 +- package-lock.json | 7 + package.json | 1 + plan.md | 6 +- tsconfig.json | 2 +- 16 files changed, 527 insertions(+), 132 deletions(-) create mode 100644 app/create-card/createCardFormReducer.spec.ts create mode 100644 app/create-card/createCardFormReducer.ts create mode 100644 app/create-card/scanner.tsx diff --git a/app/(homescreens)/my-cards/my-cards.tsx b/app/(homescreens)/my-cards/my-cards.tsx index 768bbb7..0c0c7f4 100644 --- a/app/(homescreens)/my-cards/my-cards.tsx +++ b/app/(homescreens)/my-cards/my-cards.tsx @@ -12,7 +12,7 @@ export default function MyCards() { return (