umami/components/metrics/ReferrersTable.js
2023-03-31 05:55:28 -07:00

32 lines
766 B
JavaScript

import MetricsTable from './MetricsTable';
import FilterLink from 'components/common/FilterLink';
import useMessages from 'hooks/useMessages';
export default function ReferrersTable({ websiteId, ...props }) {
const { formatMessage, labels } = useMessages();
const renderLink = ({ w: link, x: referrer }) => {
return (
<FilterLink
id="referrer"
value={referrer}
externalUrl={link}
label={!referrer && `(${formatMessage(labels.none)})`}
/>
);
};
return (
<>
<MetricsTable
{...props}
title={formatMessage(labels.referrers)}
type="referrer"
metric={formatMessage(labels.views)}
websiteId={websiteId}
renderLabel={renderLink}
/>
</>
);
}