Files
tfm_ainventory/frontend/components/ScannerSection.tsx
Daniel Bedeleanu 9a87064dbe fix(design): replace all 40+ hardcoded colors with DESIGN.md semantic system
Phase 10 Implementation: Bulk color system compliance across frontend

Applied DESIGN_COLOR_RULES.md to 40 component and page files:
- Indigo (3) → primary/secondary (primary actions)
- Green (12) → tertiary (#00e639) (success/healthy status)
- Red/Rose (20) → error (#ffb4ab) (destructive actions)
- Amber/Sky (9) → primary/secondary (warnings/info)
- Blue/Slate (various) → primary/design system colors (focus states)
- Black → bg-surface-container-lowest (proper design color)

Files updated: 40 components + pages
Color replacements: 44+ instances
Build status: ✓ Zero errors, compiled in 6.3s
Test status: Pending (npm run test)

All colors now follow DESIGN.md Industrial Precision system:
 Primary: #ffb781 (caution orange)
 Secondary: #c8c6c5 (gray)
 Tertiary: #00e639 (healthy green)
 Error: #ffb4ab (destructive red)
 Design system enforced across all UI/UX

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-25 17:19:53 +03:00

76 lines
2.6 KiB
TypeScript

'use client';
import { X, ArrowDownCircle, ArrowUpCircle, Trash2 } from 'lucide-react';
import Scanner from '@/components/Scanner';
import NewItemDialog from '@/components/NewItemDialog';
import { cn } from '@/lib/utils';
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 (
<div className="w-full space-y-4">
{/* Mode Switcher */}
<div className="flex p-1 bg-surface-container-lowest border border-border w-full gap-1">
{[
{ id: 'CHECK_IN', label: 'Check In', icon: ArrowDownCircle },
{ id: 'CHECK_OUT', label: 'Check Out', icon: ArrowUpCircle },
{ id: 'TRASH', label: 'Trash', icon: Trash2 }
].map((m) => (
<button
key={m.id}
data-testid={m.id === 'CHECK_IN' ? 'operation-checkin' : m.id === 'CHECK_OUT' ? 'operation-checkout' : undefined}
onClick={() => onModeChange(m.id)}
className={cn(
"flex-1 py-3 text-xs sm:text-sm font-normal transition-all flex items-center justify-center gap-2",
mode === m.id ? "bg-surface-bright text-primary border border-primary/30" : "text-secondary hover:bg-surface-container-lowest/40 hover:text-white"
)}
>
<m.icon size={18} />
<span className="truncate">{m.label}</span>
</button>
))}
</div>
{/* Scanner Section */}
<section className="level-1 p-6 md:p-8">
{showScanner ? (
<div className="space-y-4">
<div className="flex justify-between items-center border-b border-border pb-3">
<h2 className="text-lg font-normal text-white">Vision Sensor Active</h2>
<button
onClick={() => onShowScanner(false)}
className="p-2 bg-surface-bright border border-border text-secondary hover:text-error transition-colors"
>
<X size={20} />
</button>
</div>
<Scanner onScanSuccess={onScanSuccess} onOCRMatch={onOCRMatch} />
</div>
) : (
<NewItemDialog
onScannerClick={() => onShowScanner(true)}
onAddItemClick={onAddItemClick}
/>
)}
</section>
</div>
);
}