umami/components/metrics/EventsTable.js

30 lines
790 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';
import styles from './EventsTable.module.css';
2020-09-26 08:38:28 +02:00
export default function EventsTable({ websiteId, token, limit, onDataLoad }) {
2020-08-25 08:49:14 +02:00
return (
<MetricsTable
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}
token={token}
2020-08-25 08:49:14 +02:00
limit={limit}
2020-08-28 03:44:20 +02:00
renderLabel={({ x }) => <Label value={x} />}
2020-08-25 08:49:14 +02:00
onDataLoad={onDataLoad}
/>
);
}
2020-08-28 03:44:20 +02:00
const Label = ({ value }) => {
const [event, label] = value.split(':');
return (
<>
<span className={styles.type}>{event}</span>
{label}
</>
);
};