import Link from "next/link"; import React, { Fragment, useEffect } from "react"; import { useRouter } from "next/router"; import { signOut, useSession } from "next-auth/client"; import { Menu, Transition } from "@headlessui/react"; import { collectPageParameters, telemetryEventTypes, useTelemetry } from "../lib/telemetry"; import { SelectorIcon} from "@heroicons/react/outline"; import { CalendarIcon, ClockIcon, PuzzleIcon, SupportIcon, CogIcon, ChatAltIcon, LogoutIcon, ExternalLinkIcon, LinkIcon, } from "@heroicons/react/solid"; import Logo from "./Logo"; function classNames(...classes) { return classes.filter(Boolean).join(" "); } export default function Shell(props) { const router = useRouter(); const [session, loading] = useSession(); const telemetry = useTelemetry(); const navigation = [ { name: "Event Types", href: "/event-types", icon: LinkIcon, current: router.pathname.startsWith("/event-types"), }, { name: "Bookings", href: "/bookings", icon: ClockIcon, current: router.pathname.startsWith("/bookings"), }, { name: "Availability", href: "/availability", icon: CalendarIcon, current: router.pathname.startsWith("/availability"), }, { name: "Integrations", href: "/integrations", icon: PuzzleIcon, current: router.pathname.startsWith("/integrations"), }, { name: "Settings", href: "/settings/profile", icon: CogIcon, current: router.pathname.startsWith("/settings"), }, ]; useEffect(() => { telemetry.withJitsu((jitsu) => { return jitsu.track(telemetryEventTypes.pageView, collectPageParameters(router.pathname)); }); }, [telemetry]); const logoutHandler = () => { signOut({ redirect: false }).then(() => router.push("/auth/logout")); }; if (!loading && !session) { router.replace("/auth/login"); } return session ? (
{/* Static sidebar for desktop */}
{/* Sidebar component, swap this element with another sidebar if you like */}
{/* show top navigation for md and smaller (tablet and phones) */}

{props.heading}

{props.subtitle}

{props.CTA}
{props.children}
{/* add padding to content for mobile navigation*/}
{/* show bottom navigation for md and smaller (tablet and phones) */}
) : null; } function UserDropdown({session, small, bottom} : {session: any, small?: boolean, bottom?: boolean}){ return ( {({ open }) => ( <>
{!small && ( {session.user.name} {session.user.username} )} {!small && (
View public page
{({ active }) => ( )} {({ active }) => ( )}
{({ active }) => ( )}
)}
); }