more fixes

This commit is contained in:
Matt 2025-05-13 20:12:41 +02:00
parent 2f7f26e4fd
commit 279098e9fa

View File

@ -311,24 +311,48 @@ export function OffsetOrder({ tons, monetaryAmount, onBack, calculatorType }: Pr
</div> </div>
) : portfolio ? ( ) : portfolio ? (
<> <>
{portfolios.length > 1 && ( {portfolios.length > 0 && (
<div className="mb-8"> <div className="mb-8">
<label className="block text-sm font-medium text-gray-700 mb-2"> <h3 className="text-lg font-semibold text-gray-900 mb-4">
Select Carbon Offset Portfolio Select A Carbon Offset Portfolio
</label> </h3>
<select
value={selectedPortfolioId || ''} <div className="grid grid-cols-1 md:grid-cols-2 gap-4">
onChange={(e) => handlePortfolioChange(Number(e.target.value))}
className="block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-blue-500 focus:border-blue-500 sm:text-sm rounded-md"
>
{portfolios.map((p) => ( {portfolios.map((p) => (
<option key={p.id} value={p.id}> <div
{p.name} - {formatCurrency(p.pricePerTon, getCurrencyByCode(currency))} per ton key={p.id}
</option> onClick={() => handlePortfolioChange(p.id)}
className={`cursor-pointer border rounded-lg p-4 transition-all ${
selectedPortfolioId === p.id
? 'border-blue-500 bg-blue-50 shadow-md'
: 'border-gray-200 hover:border-blue-300 hover:bg-blue-50'
}`}
>
<div className="flex justify-between items-start mb-2">
<h4 className="text-lg font-medium text-gray-900">{p.name}</h4>
{selectedPortfolioId === p.id && (
<div className="bg-blue-500 text-white rounded-full p-1">
<Check size={16} />
</div>
)}
</div>
<p className="text-sm text-gray-600 mb-3 line-clamp-2">
{p.description}
</p>
<div className="flex justify-between items-center">
<div className="text-xs text-gray-500">
{p.projects?.length || 0} project{p.projects?.length !== 1 ? 's' : ''}
</div>
<div className="text-blue-600 font-semibold">
{formatCurrency(p.pricePerTon, getCurrencyByCode(currency))}/ton
</div>
</div>
</div>
))} ))}
</select> </div>
<p className="mt-2 text-sm text-gray-500">
Select which portfolio of climate projects you'd like to support. <p className="mt-4 text-sm text-gray-500">
Click on a portfolio to select which climate projects you'd like to support.
</p> </p>
</div> </div>
)} )}