MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / InvoiceTable

Function InvoiceTable

console/src/platform/billing/InvoiceTable.tsx:42–117  ·  view source on GitHub ↗
({
  invoices,
  planType,
}: {
  invoices: Invoice[];
  planType: PlanType;
})

Source from the content-addressed store, hash-verified

40};
41
42const InvoiceTable = ({
43 invoices,
44 planType,
45}: {
46 invoices: Invoice[];
47 planType: PlanType;
48}) => {
49 const { colors } = useTheme<MaterializeTheme>();
50 const shouldShowTotal = planType !== "capacity";
51 return (
52 <Table variant="standalone" data-testid="invoice-table">
53 <Thead>
54 <Tr>
55 <Th {...headerProps}>Name</Th>
56 <Th {...headerProps}>Date received</Th>
57 {shouldShowTotal && (
58 <Th {...headerProps} isNumeric>
59 Total
60 </Th>
61 )}
62 <Th {...headerProps}></Th>
63 </Tr>
64 </Thead>
65 <Tbody>
66 {invoices.map((invoice, i) => {
67 const url = invoice.webUrl || invoice.pdfUrl;
68 const isDraft = invoice.status === "draft";
69 return (
70 <Tr key={i}>
71 <Td>
72 <Text
73 textStyle="text-ui-med"
74 textColor={
75 isDraft
76 ? colors.foreground.secondary
77 : colors.foreground.primary
78 }
79 fontStyle={isDraft ? "italic" : "normal"}
80 >
81 {isDraft ? "(Draft)" : invoice.invoiceNumber}
82 </Text>
83 </Td>
84 <Td>
85 <Text textStyle="text-ui-med">
86 {formatDateInUtc(new Date(invoice.issueDate), "MMM d, yyyy")}
87 </Text>
88 </Td>
89 {shouldShowTotal && (
90 <Td isNumeric>
91 <Text textStyle="text-ui-med">
92 {formatCurrency(parseFloat(invoice.total))}
93 </Text>
94 </Td>
95 )}
96 <Td textAlign="end">
97 {url && (
98 <TextLink
99 href={url}

Callers

nothing calls this directly

Calls 3

formatDateInUtcFunction · 0.90
formatCurrencyFunction · 0.90
mapMethod · 0.45

Tested by

no test coverage detected