import React, { useState } from 'react'; 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 EmptyPlaceholder from 'components/common/EmptyPlaceholder'; import Icon from 'components/common/Icon'; import useFetch from 'hooks/useFetch'; import useUser from 'hooks/useUser'; import ChevronDown from 'assets/chevron-down.svg'; import styles from './TestConsole.module.css'; export default function TestConsole() { const { user } = useUser(); const [website, setWebsite] = useState(); const [show, setShow] = useState(true); const { basePath } = useRouter(); const { data } = useFetch('/websites'); if (!data || !user?.is_admin) { return null; } const options = data.map(({ name, website_id }) => ({ label: name, value: website_id })); const selectedValue = options.find(({ value }) => value === website?.website_id)?.value; function handleSelect(value) { setWebsite(data.find(({ website_id }) => website_id === value)); } function handleClick() { window.umami('event (default)'); window.umami.trackView('/page-view', 'https://www.google.com'); window.umami.trackEvent('event (custom)', 'custom-type'); } return ( {typeof window !== 'undefined' && website && (