Fix custom calculator type: use monetary amount instead of CO₂ tons
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m29s
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m29s
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 <noreply@anthropic.com>
This commit is contained in:
parent
b93d054558
commit
273388bad6
@ -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' && (
|
||||
<div className="mb-6">
|
||||
<label className="block text-sm font-medium text-gray-700 mb-2">
|
||||
Custom Amount (tons CO₂)
|
||||
Custom Amount (USD)
|
||||
</label>
|
||||
<input
|
||||
type="number"
|
||||
value={customAmount}
|
||||
onChange={(e) => 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"
|
||||
/>
|
||||
<p className="mt-1 text-xs text-gray-500">
|
||||
Monetary amount to spend on carbon offsets (calculator will convert to CO₂)
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
|
||||
|
||||
@ -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';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user