umami/components/metrics/EventsTable.js

30 lines
799 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-08-31 23:11:30 +02:00
export default function EventsTable({ websiteId, limit, onExpand, 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}
limit={limit}
2020-08-28 03:44:20 +02:00
renderLabel={({ x }) => <Label value={x} />}
2020-08-25 08:49:14 +02:00
onExpand={onExpand}
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}
</>
);
};