import classNames from 'classnames';
import { Flexbox, Row, Column, Text, Button, Icon } from 'react-basics';
import Link from 'next/link';
import { useRouter } from 'next/router';
import Favicon from 'components/common/Favicon';
import ActiveUsers from 'components/metrics/ActiveUsers';
import styles from './WebsiteHeader.module.css';
import Icons from 'components/icons';
import { useMessages, useWebsite } from 'hooks';
export function WebsiteHeader({ websiteId, showLinks = true, children }) {
const { formatMessage, labels } = useMessages();
const { pathname } = useRouter();
const { data: website } = useWebsite(websiteId);
const { name, domain } = website || {};
const links = [
{
label: formatMessage(labels.overview),
icon: ,
path: '',
},
{
label: formatMessage(labels.realtime),
icon: ,
path: '/realtime',
},
{
label: formatMessage(labels.reports),
icon: ,
path: '/reports',
},
{
label: formatMessage(labels.eventData),
icon: ,
path: '/event-data',
},
];
return (
{name}
{showLinks && (
{links.map(({ label, icon, path }) => {
const selected = path ? pathname.endsWith(path) : pathname === '/websites/[id]';
return (
);
})}
)}
{children}
);
}
export default WebsiteHeader;