import { convertToGB } from '@/config/func'
import { FC } from 'react'
import { AddressData } from '../types/Types'
import ProgressBar from '@/components/ProgressBar'

const ProgressBarEmail: FC<{ item: AddressData }> = ({ item }) => {
    const usedQuota = item.emailQuotaUsed || 0;
    const totalQuota = item.emailQuota || 0;
    const percentage = Math.min((usedQuota / totalQuota) * 100, 100);

    return (
        <div className='flex flex-col gap-2'>
            <div className='flex justify-between text-sm'>
                <span className='text-gray-600 dltr'>
                    {convertToGB(usedQuota)} GB / {convertToGB(totalQuota)} GB
                </span>
                {/* <span className='text-gray-500'>
                                {percentage.toFixed(1)}%
                            </span> */}
            </div>
            <ProgressBar percentage={percentage} />
        </div>
    )
}

export default ProgressBarEmail