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