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-07 07:52:17 +02:00
|
|
|
const { groups = [] } = report?.parameters || {};
|
2023-07-08 05:38:43 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<GridTable data={report?.data || []}>
|
2023-08-07 07:52:17 +02:00
|
|
|
{groups.map(({ name, label }) => {
|
|
|
|
return <GridColumn key={name} name={name} label={label} />;
|
2023-08-03 19:44:35 +02:00
|
|
|
})}
|
2023-08-07 07:52:17 +02:00
|
|
|
<GridColumn name="views" label={formatMessage(labels.views)} width="100px" />
|
|
|
|
<GridColumn name="visitors" label={formatMessage(labels.visitors)} width="100px" />
|
2023-07-08 05:38:43 +02:00
|
|
|
</GridTable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default InsightsTable;
|