import { Fragment, useEffect, useState } from "react"; import { useRouter } from "next/router"; import { Tab } from "@headlessui/react"; import { AuditLogStreamsTab } from "../AuditLogStreamTab"; import { OrgAuthTab } from "../OrgAuthTab"; import { OrgEncryptionTab } from "../OrgEncryptionTab"; import { OrgGeneralTab } from "../OrgGeneralTab"; import { OrgWorkflowIntegrationTab } from "../OrgWorkflowIntegrationTab/OrgWorkflowIntegrationTab"; const tabs = [ { name: "General", key: "tab-org-general" }, { name: "Security", key: "tab-org-security" }, { name: "Encryption", key: "tab-org-encryption" }, { name: "Workflow Integrations", key: "workflow-integrations" }, { name: "Audit Log Streams", key: "tag-audit-log-streams" } ]; export const OrgTabGroup = () => { const { query } = useRouter(); const [selectedTabIndex, setSelectedTabIndex] = useState(0); const selectedTab = query.selectedTab as string; useEffect(() => { if (selectedTab) { const index = tabs.findIndex((tab) => tab.key === selectedTab); if (index !== -1) { setSelectedTabIndex(index); } } }, [selectedTab]); return ( {tabs.map((tab) => ( {({ selected }) => ( )} ))} ); };