diff --git a/frontend/components/ScannerSection.tsx b/frontend/components/ScannerSection.tsx new file mode 100644 index 00000000..1f9e2e19 --- /dev/null +++ b/frontend/components/ScannerSection.tsx @@ -0,0 +1,80 @@ +'use client'; + +import { X, ArrowDownCircle, ArrowUpCircle, Trash2 } from 'lucide-react'; +import Scanner from '@/components/Scanner'; +import NewItemDialog from '@/components/NewItemDialog'; +import { clsx, type ClassValue } from 'clsx'; +import { twMerge } from 'tailwind-merge'; + +function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} + +interface ScannerSectionProps { + mode: string; + onModeChange: (mode: string) => void; + showScanner: boolean; + onShowScanner: (show: boolean) => void; + onScanSuccess: (result: any) => void; + onOCRMatch: (result: any) => void; + onAddItemClick: () => void; +} + +export default function ScannerSection({ + mode, + onModeChange, + showScanner, + onShowScanner, + onScanSuccess, + onOCRMatch, + onAddItemClick, +}: ScannerSectionProps) { + return ( +
+ {/* Mode Switcher */} +
+ {[ + { id: 'CHECK_IN', label: 'Check In', icon: ArrowDownCircle }, + { id: 'CHECK_OUT', label: 'Check Out', icon: ArrowUpCircle }, + { id: 'TRASH', label: 'Trash', icon: Trash2 } + ].map((m) => ( + + ))} +
+ + {/* Scanner Section */} +
+ {showScanner ? ( +
+
+

scanning...

+ +
+ +
+ ) : ( + onShowScanner(true)} + onAddItemClick={onAddItemClick} + /> + )} +
+
+ ); +}