import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import MetricsTable from './MetricsTable';
import { refFilter } from 'lib/filters';
import ButtonGroup from 'components/common/ButtonGroup';
import { FILTER_DOMAIN_ONLY, FILTER_COMBINED, FILTER_RAW } from 'lib/constants';
import ButtonLayout from '../layout/ButtonLayout';
export default function ReferrersTable({ websiteId, websiteDomain, token, limit, showFilters }) {
const [filter, setFilter] = useState(FILTER_COMBINED);
const buttons = [
{
label: ,
value: FILTER_DOMAIN_ONLY,
},
{
label: ,
value: FILTER_COMBINED,
},
{ label: , value: FILTER_RAW },
];
const renderLink = ({ w: href, x: url }) => {
return (href || url).startsWith('http') ? (
{decodeURI(url)}
) : (
decodeURI(url)
);
};
return (
<>
{showFilters && }
}
type="referrer"
metric={}
websiteId={websiteId}
websiteDomain={websiteDomain}
token={token}
limit={limit}
dataFilter={refFilter}
filterOptions={{
domain: websiteDomain,
domainOnly: filter === FILTER_DOMAIN_ONLY,
raw: filter === FILTER_RAW,
}}
renderLabel={renderLink}
/>
>
);
}
const FilterButtons = ({ buttons, selected, onClick }) => {
return (
);
};