import clsx from 'clsx' import { useTranslation } from 'react-i18next' import TimeAgo from 'react-timeago' import { VestingPaymentLineProps } from '@dao-dao/types' import { formatDate, formatDateTimeTz } from '@dao-dao/utils' import { useTranslatedTimeDeltaFormatter } from '../../hooks' import { ChainProvider } from '../chain' import { TokenAmountDisplay } from '../token' import { Tooltip } from '../tooltip' export const VestingPaymentLine = ({ vestingInfo, onClick, transparentBackground, EntityDisplay, }: VestingPaymentLineProps) => { const { t } = useTranslation() const startTimeAgoFormatter = useTranslatedTimeDeltaFormatter({ words: true, futureMode: 'in', }) const endTimeAgoFormatter = useTranslatedTimeDeltaFormatter({ words: true, futureMode: 'left', }) const { chainId, vest, token, vested, distributable, total, completed, startDate, endDate, } = vestingInfo return (
{completed ? ( <>
{endDate ? (

{formatDate(endDate, true)}

) : (

{t('info.unknown')}

)}
{/* Only show balance available to withdraw if nonzero. */} {distributable.isPositive() && ( )}
) : ( <>
{startDate ? (
) : (

{t('info.unknown')}

)}
{endDate ? (
) : (

{t('info.unknown')}

)}

/

)}
) }