umami/components/metrics/EventsTable.js

28 lines
689 B
JavaScript
Raw Normal View History

2020-08-25 08:49:14 +02:00
import React from 'react';
2020-09-06 02:27:01 +02:00
import { FormattedMessage } from 'react-intl';
2020-08-25 08:49:14 +02:00
import MetricsTable from './MetricsTable';
2020-10-09 21:39:03 +02:00
import Tag from 'components/common/Tag';
2020-08-25 08:49:14 +02:00
2020-10-11 11:29:55 +02:00
export default function EventsTable({ websiteId, ...props }) {
2020-08-25 08:49:14 +02:00
return (
<MetricsTable
2020-10-11 10:33:26 +02:00
{...props}
2020-09-06 02:27:01 +02:00
title={<FormattedMessage id="metrics.events" defaultMessage="Events" />}
2020-08-25 08:49:14 +02:00
type="event"
2020-09-06 02:27:01 +02:00
metric={<FormattedMessage id="metrics.actions" defaultMessage="Actions" />}
2020-08-25 08:49:14 +02:00
websiteId={websiteId}
2020-08-28 03:44:20 +02:00
renderLabel={({ x }) => <Label value={x} />}
2020-08-25 08:49:14 +02:00
/>
);
}
2020-08-28 03:44:20 +02:00
const Label = ({ value }) => {
const [event, label] = value.split(':');
return (
<>
2020-10-09 21:39:03 +02:00
<Tag>{event}</Tag>
2020-08-28 03:44:20 +02:00
{label}
</>
);
};