2023-07-08 05:38:43 +02:00
|
|
|
import { useContext } from 'react';
|
|
|
|
import { GridTable, GridColumn } from 'react-basics';
|
|
|
|
import { useMessages } from 'hooks';
|
|
|
|
import { ReportContext } from '../Report';
|
|
|
|
|
|
|
|
export function InsightsTable() {
|
|
|
|
const { report } = useContext(ReportContext);
|
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-08-03 19:44:35 +02:00
|
|
|
const { fields = [] } = report?.parameters || {};
|
2023-07-08 05:38:43 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<GridTable data={report?.data || []}>
|
2023-08-03 19:44:35 +02:00
|
|
|
{fields.map(({ name }) => {
|
|
|
|
return <GridColumn key={name} name={name} label={name} />;
|
|
|
|
})}
|
2023-07-08 05:38:43 +02:00
|
|
|
<GridColumn name="total" label={formatMessage(labels.total)} />
|
|
|
|
</GridTable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default InsightsTable;
|