import { Button, Column, Loading, Row } from 'react-basics';
import Head from 'next/head';
import Link from 'next/link';
import { useRouter } from 'next/router';
import DropDown from 'components/common/DropDown';
import Page from 'components/layout/Page';
import PageHeader from 'components/layout/PageHeader';
import EventsChart from 'components/metrics/EventsChart';
import WebsiteChart from 'components/metrics/WebsiteChart';
import useApi from 'hooks/useApi';
import styles from './TestConsole.module.css';
export default function TestConsole() {
const { get, useQuery } = useApi();
const { data, isLoading } = useQuery(['websites:test-console'], () =>
get('/websites?include_all=true'),
);
const router = useRouter();
const {
basePath,
query: { id },
} = router;
const websiteId = id?.[0];
if (isLoading) {
return ;
}
if (!data) {
return null;
}
const options = data.map(({ name, id }) => ({ label: name, value: id }));
const website = data.find(({ id }) => websiteId === id);
const selectedValue = options.find(({ value }) => value === website?.id)?.value;
function handleSelect(value) {
router.push(`/console/${value}`);
}
function handleClick() {
window.umami('umami-default');
window.umami.trackView('/page-view', 'https://www.google.com');
window.umami.trackEvent('track-event-no-data');
window.umami.trackEvent('track-event-with-data', { test: 'test-data', time: Date.now() });
}
return (
{typeof window !== 'undefined' && website && (
)}
Test Console
{website && (
<>
Page links
CSS events
Javascript events
Events
>
)}
);
}