import {useState} from 'react'; import {useTheme} from '@emotion/react'; import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; import {Tooltip} from 'sentry/components/tooltip'; import {IconDelete, IconEdit} from 'sentry/icons'; import {t} from 'sentry/locale'; import {space} from 'sentry/styles/space'; import {displayPrice} from 'getsentry/views/amCheckout/utils'; import type {BigNumUnits} from '../utils'; import {bigNumFormatter} from '../utils'; import {Centered, Divider, HalvedWithDivider} from './styles'; import type {SpendAllocation} from './types'; type AllocationRowProps = { allocation: SpendAllocation; deleteAction: (e: React.MouseEvent) => void; metricUnit: BigNumUnits; openForm: (e: React.MouseEvent) => void; }; function AllocationRow({ allocation, deleteAction, metricUnit, openForm, }: AllocationRowProps) { const [deleteHovered, setDeleteHovered] = useState(false); const [editHovered, setEditHovered] = useState(false); const theme = useTheme(); return ( {allocation.targetSlug} {allocation.costPerItem === 0 && ( -- )} {allocation.costPerItem > 0 && ( {displayPrice({ cents: allocation.costPerItem * allocation.reservedQuantity, })} )} {bigNumFormatter(allocation.reservedQuantity, undefined, metricUnit)} {allocation.costPerItem === 0 && ( -- )} {allocation.costPerItem > 0 && ( {displayPrice({ cents: allocation.costPerItem * allocation.consumedQuantity, })} )} allocation.reservedQuantity ? `${allocation.consumedQuantity} (${ allocation.consumedQuantity - allocation.reservedQuantity } over)` : allocation.consumedQuantity ).toLocaleString()} > allocation.reservedQuantity ? {color: theme.red400} : {} } > {bigNumFormatter(allocation.consumedQuantity, 2, metricUnit)} {allocation.targetType !== 'Organization' && (