2023-07-10 14:46:45 +02:00
|
|
|
import Link from 'next/link';
|
2023-07-10 13:35:19 +02:00
|
|
|
import { GridTable, GridColumn } from 'react-basics';
|
2023-07-10 14:46:45 +02:00
|
|
|
import { useMessages, usePageQuery } from 'hooks';
|
|
|
|
import Empty from 'components/common/Empty';
|
2023-07-10 13:35:19 +02:00
|
|
|
|
2023-07-11 10:16:17 +02:00
|
|
|
export function EventDataTable({ data = [] }) {
|
2023-07-10 13:35:19 +02:00
|
|
|
const { formatMessage, labels } = useMessages();
|
2023-07-10 14:46:45 +02:00
|
|
|
const { resolveUrl } = usePageQuery();
|
|
|
|
|
|
|
|
if (data.length === 0) {
|
|
|
|
return <Empty />;
|
|
|
|
}
|
2023-07-10 13:35:19 +02:00
|
|
|
|
|
|
|
return (
|
|
|
|
<GridTable data={data}>
|
2023-07-10 14:46:45 +02:00
|
|
|
<GridColumn name="field" label={formatMessage(labels.field)}>
|
|
|
|
{row => {
|
|
|
|
return (
|
|
|
|
<Link href={resolveUrl({ view: row.field })} shallow={true}>
|
|
|
|
{row.field}
|
|
|
|
</Link>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</GridColumn>
|
|
|
|
<GridColumn name="total" label={formatMessage(labels.totalRecords)}>
|
2023-07-10 13:35:19 +02:00
|
|
|
{({ total }) => total.toLocaleString()}
|
|
|
|
</GridColumn>
|
|
|
|
</GridTable>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default EventDataTable;
|