From 273388bad6a3fa29f6b0684f82eae1db57974a5b Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 3 Nov 2025 21:00:14 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20custom=20calculator=20type:=20use=20monet?= =?UTF-8?q?ary=20amount=20instead=20of=20CO=E2=82=82=20tons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Critical fix: The 'custom' calculation type should represent monetary amount (USD) to spend on carbon offsets, not tons of CO₂. The calculator converts money to CO₂, not the other way around. Changes: - Update test page label from "Custom Amount (tons CO₂)" to "Custom Amount (USD)" - Add helper text explaining calculator converts money to CO₂ - Update description function to show "$100 USD" instead of "100 tons CO₂" - Change default/preset values to realistic dollar amounts ($50 default, $100 preset) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- app/qr-test/page.tsx | 10 +++++++--- src/utils/qrDataValidator.ts | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/qr-test/page.tsx b/app/qr-test/page.tsx index 8ec82ec..092fe38 100644 --- a/app/qr-test/page.tsx +++ b/app/qr-test/page.tsx @@ -12,7 +12,7 @@ export default function QRTestPage() { const [fuelRate, setFuelRate] = useState('100'); const [fuelAmount, setFuelAmount] = useState('500'); const [fuelUnit, setFuelUnit] = useState<'liters' | 'gallons'>('liters'); - const [customAmount, setCustomAmount] = useState('5'); + const [customAmount, setCustomAmount] = useState('50'); const [vesselName, setVesselName] = useState(''); const [imo, setImo] = useState(''); @@ -38,7 +38,7 @@ export default function QRTestPage() { }, custom: { calculationType: 'custom' as const, - customAmount: 5, + customAmount: 100, }, }; @@ -284,14 +284,18 @@ export default function QRTestPage() { {calculationType === 'custom' && (
setCustomAmount(e.target.value)} + placeholder="e.g., 100" className="w-full px-4 py-2 border border-gray-300 rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent" /> +

+ Monetary amount to spend on carbon offsets (calculator will convert to CO₂) +

)} diff --git a/src/utils/qrDataValidator.ts b/src/utils/qrDataValidator.ts index 088cd4e..824e857 100644 --- a/src/utils/qrDataValidator.ts +++ b/src/utils/qrDataValidator.ts @@ -165,7 +165,7 @@ export function getQRDataDescription(data: QRCalculatorData): string { case 'distance': return `Distance-based: ${data.distance} nm at ${data.speed} knots`; case 'custom': - return `Custom: ${data.customAmount} tons CO₂`; + return `Custom: $${data.customAmount} USD`; default: return 'Unknown calculation type'; }