Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | import { css } from '@emotion/react'; import { memo } from 'react'; import { FormattedMessage } from 'react-intl'; import { Paper } from '@allshares/studio-design-system'; import { type PaymentAmountsByCategory } from '@amalia/core/types'; import { type CurrencySymbolsEnum } from '@amalia/ext/iso-4217'; import { PaymentsMetric } from './metric/PaymentsMetric'; export type PaymentsMetricsProps = { readonly amounts?: PaymentAmountsByCategory; readonly currency: CurrencySymbolsEnum; }; export const PaymentsMetrics = memo(function PaymentsMetrics({ amounts, currency }: PaymentsMetricsProps) { return ( <Paper css={css` display: flex; align-items: stretch; `} > <PaymentsMetric currency={currency} isLoading={!amounts} label={<FormattedMessage defaultMessage="Total achieved" />} value={amounts?.achievement ?? undefined} /> <PaymentsMetric currency={currency} isLoading={!amounts} label={<FormattedMessage defaultMessage="Paid" />} value={amounts?.paid ?? undefined} /> <PaymentsMetric currency={currency} isLoading={!amounts} label={<FormattedMessage defaultMessage="Remaining" />} value={(amounts?.achievement ?? 0) - (amounts?.paid ?? 0)} /> </Paper> ); }); |