allow showing pageview custom data on website detail page

This commit is contained in:
Ewen Le Bihan 2023-12-17 03:01:39 +01:00
parent 46dd16260a
commit 996c02ef1a
5 changed files with 77 additions and 4 deletions

View file

@ -9,13 +9,17 @@ import WorldMap from 'components/metrics/WorldMap';
import CountriesTable from 'components/metrics/CountriesTable';
import EventsTable from 'components/metrics/EventsTable';
import EventsChart from 'components/metrics/EventsChart';
import PageviewCustomDataTable from 'components/metrics/PageviewCustomDataTable';
import { chunkArray } from 'next-basics';
export default function WebsiteTableView({
websiteId,
domainName,
customDataFields,
}: {
websiteId: string;
domainName: string;
customDataFields: string[];
}) {
const [countryData, setCountryData] = useState();
const tableProps = {
@ -35,6 +39,16 @@ export default function WebsiteTableView({
<OSTable {...tableProps} />
<DevicesTable {...tableProps} />
</GridRow>
{chunkArray(customDataFields, 3).map((fields, index) => (
<GridRow
key={index}
columns={fields.length === 1 ? 'one' : fields.length === 2 ? 'two' : 'three'}
>
{fields.map(field => (
<PageviewCustomDataTable key="custom" {...tableProps} fieldName={field} />
))}
</GridRow>
))}
<GridRow columns="two-one">
<WorldMap data={countryData} />
<CountriesTable {...tableProps} onDataLoad={setCountryData} />