2020-08-23 04:05:07 +02:00
|
|
|
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';
|
2020-08-23 04:05:07 +02:00
|
|
|
|
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
|
|
|
|
2022-04-10 12:51:43 +02:00
|
|
|
const renderLink = ({ w: link, x: referrer }) => {
|
2023-03-31 14:55:28 +02:00
|
|
|
return (
|
|
|
|
<FilterLink
|
|
|
|
id="referrer"
|
|
|
|
value={referrer}
|
|
|
|
externalUrl={link}
|
|
|
|
label={!referrer && `(${formatMessage(labels.none)})`}
|
|
|
|
/>
|
2022-07-21 10:11:10 +02:00
|
|
|
);
|
2020-08-23 09:23:47 +02:00
|
|
|
};
|
|
|
|
|
2020-08-23 04:05:07 +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}
|
|
|
|
/>
|
|
|
|
</>
|
2020-08-23 04:05:07 +02:00
|
|
|
);
|
|
|
|
}
|