import DigitalProgressBar from '@/components/DigitalProgressBar'; import { type Bucket } from '@/types'; const centsToDollars = (cents: number): number => cents / 100; const basisPointsToPercent = (bp: number): number => bp / 100; const formatDollars = (cents: number): string => `$${centsToDollars(cents).toFixed(0)}`; export default function BucketCard({ bucket, projectedAmount }: { bucket: Bucket; projectedAmount?: number }) { const hasFiniteCapacity = bucket.allocation_type === 'fixed_limit' && bucket.effective_capacity !== null; return (
{/* Name */}
{bucket.name}
{/* Progress bars or text — fixed height */}
{hasFiniteCapacity ? (
) : (
{bucket.allocation_type === 'unlimited' ? '~ ALL REMAINING ~' : `~ ${basisPointsToPercent(bucket.allocation_value ?? 0).toFixed(2)}% ~`}
)}
{/* Amount */}
{formatDollars(bucket.current_balance)} {projectedAmount && projectedAmount > 0 && ( {' '}+{formatDollars(projectedAmount)} )} {hasFiniteCapacity && ( {' '}/ {formatDollars(bucket.effective_capacity!)} )}
); }