import Link from 'next/link' import { PropsWithChildren } from 'react' import { useParams } from 'common' import { useCurrentPath } from 'hooks/misc/useCurrentPath' import { useIsFeatureEnabled } from 'hooks/misc/useIsFeatureEnabled' import { NavMenu, NavMenuItem } from 'ui' import { ScaffoldContainerLegacy, ScaffoldTitle } from '../Scaffold' function OrganizationSettingsLayout({ children }: PropsWithChildren) { const { slug } = useParams() // Get the path without any hash values const fullCurrentPath = useCurrentPath() const [currentPath] = fullCurrentPath.split('#') const { organizationShowSsoSettings: showSsoSettings, organizationShowSecuritySettings: showSecuritySettings, organizationShowLegalDocuments: showLegalDocuments, } = useIsFeatureEnabled([ 'organization:show_sso_settings', 'organization:show_security_settings', 'organization:show_legal_documents', ]) const navMenuItems = [ { label: 'General', href: `/org/${slug}/general`, }, ...(showSecuritySettings ? [ { label: 'Security', href: `/org/${slug}/security`, }, ] : []), { label: 'OAuth Apps', href: `/org/${slug}/apps`, }, ...(showSsoSettings ? [ { label: 'SSO', href: `/org/${slug}/sso`, }, ] : []), { label: 'Audit Logs', href: `/org/${slug}/audit`, }, ...(showLegalDocuments ? [ { label: 'Legal Documents', href: `/org/${slug}/documents`, }, ] : []), ] return ( <> Organization Settings {(navMenuItems.filter(Boolean) as { label: string; href: string }[]).map((item) => ( {item.label} ))}
{children}
) } export default OrganizationSettingsLayout