import { CustomersIcon, DashboardIcon, FormIcon } from "@formbricks/ui"; import { Disclosure } from "@headlessui/react"; import { Bars3Icon, XMarkIcon } from "@heroicons/react/24/outline"; import clsx from "clsx"; import Link from "next/link"; import { useRouter } from "next/router"; import { useMemo } from "react"; interface LayoutWrapperOrganisationProps { children: React.ReactNode; } export default function LayoutWrapperOrganisation({ children }: LayoutWrapperOrganisationProps) { const router = useRouter(); const navigation = useMemo( () => [ { name: "Forms", href: `/organisations/${router.query.organisationId}/forms`, icon: FormIcon, current: router.pathname.includes("/form"), }, { name: "Customers", href: `/organisations/${router.query.organisationId}/customers`, icon: CustomersIcon, current: router.pathname.includes("/customers"), }, { name: "Integrations", href: `/organisations/${router.query.organisationId}/integrations`, icon: DashboardIcon, current: router.pathname.includes("/integrations"), }, ], [router] ); return (
{({ open }) => ( <>
{navigation.map((item) => ( router.push(item.href)} className={clsx( item.current ? "bg-slate-100 text-slate-900" : "text-slate-900 hover:bg-slate-50 hover:text-slate-900", "block rounded-md py-2 px-3 text-base font-medium" )} aria-current={item.current ? "page" : undefined}> {item.name} ))}
)}
{children}
); }