umami/components/metrics/EventsTable.js
2020-10-11 02:29:55 -07:00

28 lines
689 B
JavaScript

import React from 'react';
import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable';
import Tag from 'components/common/Tag';
export default function EventsTable({ websiteId, ...props }) {
return (
<MetricsTable
{...props}
title={<FormattedMessage id="metrics.events" defaultMessage="Events" />}
type="event"
metric={<FormattedMessage id="metrics.actions" defaultMessage="Actions" />}
websiteId={websiteId}
renderLabel={({ x }) => <Label value={x} />}
/>
);
}
const Label = ({ value }) => {
const [event, label] = value.split(':');
return (
<>
<Tag>{event}</Tag>
{label}
</>
);
};