umami/components/metrics/ReferrersTable.js

32 lines
767 B
JavaScript
Raw Normal View History

import MetricsTable from './MetricsTable';
2022-04-10 12:51:43 +02:00
import FilterLink from 'components/common/FilterLink';
2023-03-22 22:05:55 +01:00
import useMessages from 'hooks/useMessages';
2023-03-20 21:39:40 +01:00
export default function ReferrersTable({ websiteId, ...props }) {
2023-03-22 22:05:55 +01:00
const { formatMessage, labels } = useMessages();
2020-09-06 02:27:01 +02:00
2023-04-02 00:44:30 +02:00
const renderLink = ({ x: referrer }) => {
2023-03-31 14:55:28 +02:00
return (
<FilterLink
id="referrer"
value={referrer}
2023-04-02 00:44:30 +02:00
externalUrl={`https://${referrer}`}
label={!referrer && formatMessage(labels.none)}
2023-03-31 14:55:28 +02:00
/>
);
2020-08-23 09:23:47 +02:00
};
return (
2020-09-22 06:34:55 +02:00
<>
<MetricsTable
2020-10-11 10:33:26 +02:00
{...props}
2023-02-10 12:26:57 +01:00
title={formatMessage(labels.referrers)}
2020-09-22 06:34:55 +02:00
type="referrer"
2023-02-10 12:26:57 +01:00
metric={formatMessage(labels.views)}
2020-09-22 06:34:55 +02:00
websiteId={websiteId}
renderLabel={renderLink}
/>
</>
);
}