Task 7: QR Code Generator - Implementation Preparation Complete
Status: Ready for deployment when server is online
Date Prepared: March 24, 2026
Component File: QRCodeGeneratorClient.tsx
Staging Location: /c/Users/John/webtools-dev-batch/QRCodeGeneratorClient.tsx
Target Location: /home/websites1/webtools/src/app/components/tools/QRCodeGeneratorClient.tsx
Implementation Details
Component Features
- Text/URL input field with textarea (4 rows)
- QR code size slider (100-500px, default 200px)
- Error correction level selector:
- Low (7%)
- Medium (15%) - default
- High (25%)
- Very High (30%)
- Real-time QR code generation using QRCode.js library
- Download functionality (PNG format)
- Ad unit integration (slot 4001006004)
Technical Stack
- Framework: Next.js (React Client Component)
- Library: qrcodejs v1.0.0 (CDN: cdnjs.cloudflare.com)
- Styling: Tailwind CSS with dark theme
- Ad Integration: AdUnit component at bottom
Key Implementation Points
- Script Loading: Uses Next.js Script component with afterInteractive strategy
- Global Type Declaration: Declares Window.QRCode interface for TypeScript
- State Management:
- input: QR content (default: "https://usefultoolsonline.com")
- size: QR dimensions in pixels
- errorLevel: Error correction level (L/M/Q/H)
- scriptReady: CDN script load status
- Download Handler: Extracts canvas from QR generator and triggers PNG download
- Effect Hook: Regenerates QR code whenever input, size, or errorLevel changes
Pre-Deployment Verification
- Component file created and syntax verified
- All imports present (React hooks, Next.js Script, AdUnit)
- State initialization correct
- useEffect dependencies properly configured
- Download functionality implemented
- Tailwind styling consistent with project (dark theme)
- AdUnit slot specified: 4001006004
- TypeScript types defined
- CDN library reference valid
Dependencies Required
- react
- next
- @/app/components/AdUnit (existing component in project)
- tailwindcss (for styling)
- qrcodejs library (loaded via CDN)
Testing Checklist (On Server)
When deployed to server, verify:
- QR Code generates on text input change
- Size slider updates QR dimensions (100-500px range)
- Error correction level dropdown changes error correction
- Download button works and saves as PNG
- Default value (usefultoolsonline.com URL) displays correctly
- Script ready state prevents download until CDN loads
- Ad unit displays below component
- Styling matches other tool components
Deployment Command
When server is online, deploy to /home/websites1/webtools/src/app/components/tools/:
scp QRCodeGeneratorClient.tsx [email protected]:/home/websites1/webtools/src/app/components/tools/
Then trigger build/deployment process on server.
Notes
- Component uses client-side rendering ("use client" directive)
- QR library is loaded externally via CDN for better performance
- Default input set to usefultoolsonline.com as per specification
- Download generates PNG only (qrcodejs provides canvas export)