Moved events components to events page. Updated map data loading.

This commit is contained in:
Mike Cao 2024-08-08 12:00:38 -07:00
parent c6b8114945
commit f135e4ffbb
8 changed files with 52 additions and 35 deletions

View file

@ -7,6 +7,7 @@ import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { ReactNode } from 'react';
import { Button, Icon, Text } from 'react-basics';
import Lightning from 'assets/lightning.svg';
import styles from './WebsiteHeader.module.css';
export function WebsiteHeader({
@ -52,7 +53,7 @@ export function WebsiteHeader({
},
{
label: formatMessage(labels.events),
icon: <Icons.Bolt />,
icon: <Lightning />,
path: '/events',
},
];

View file

@ -1,4 +1,3 @@
import { useState } from 'react';
import { Grid, GridRow } from 'components/layout/Grid';
import PagesTable from 'components/metrics/PagesTable';
import ReferrersTable from 'components/metrics/ReferrersTable';
@ -9,13 +8,15 @@ 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 { usePathname } from 'next/navigation';
export default function WebsiteTableView({ websiteId }: { websiteId: string }) {
const [countryData, setCountryData] = useState();
const pathname = usePathname();
const tableProps = {
websiteId,
limit: 10,
};
const isSharePage = pathname.includes('/share/');
return (
<Grid>
@ -29,13 +30,15 @@ export default function WebsiteTableView({ websiteId }: { websiteId: string }) {
<DevicesTable {...tableProps} />
</GridRow>
<GridRow columns="two-one">
<WorldMap data={countryData} />
<CountriesTable {...tableProps} onDataLoad={setCountryData} />
</GridRow>
<GridRow columns="one-two">
<EventsTable {...tableProps} />
<EventsChart websiteId={websiteId} />
<WorldMap websiteId={websiteId} />
<CountriesTable {...tableProps} />
</GridRow>
{isSharePage && (
<GridRow columns="one-two">
<EventsTable {...tableProps} />
<EventsChart websiteId={websiteId} />
</GridRow>
)}
</Grid>
);
}