import classNames from 'classnames'; import Head from 'next/head'; import Link from 'next/link'; import { useRouter } from 'next/router'; import Page from 'components/layout/Page'; import PageHeader from 'components/layout/PageHeader'; import DropDown from 'components/common/DropDown'; import WebsiteChart from 'components/metrics/WebsiteChart'; import EventsChart from 'components/metrics/EventsChart'; import Button from 'components/common/Button'; import useFetch from 'hooks/useFetch'; import styles from './TestConsole.module.css'; export default function TestConsole() { const { data } = useFetch('/websites'); const router = useRouter(); const { basePath, query: { id }, } = router; const websiteId = id?.[0]; if (!data) { return null; } const options = data.map(({ name, websiteId }) => ({ label: name, value: websiteId })); const website = data.find(({ websiteId }) => websiteId === +websiteId); const selectedValue = options.find(({ value }) => value === website?.websiteId)?.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 && (