import Link from 'next/link'
import { PropsWithChildren } from 'react'
import { useParams } from 'common'
import { useCurrentPath } from 'hooks/misc/useCurrentPath'
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('#')
// Hide these settings in the new layout on the following paths
const isHidden = (path: string) => {
return (
path === `/org/${slug}/team` ||
path === `/org/${slug}/integrations` ||
path === `/org/${slug}/usage` ||
path === `/org/${slug}/billing`
)
}
if (isHidden(currentPath)) {
return children
}
const navMenuItems = [
{
label: 'General',
href: `/org/${slug}/general`,
},
{
label: 'Security',
href: `/org/${slug}/security`,
},
{
label: 'OAuth Apps',
href: `/org/${slug}/apps`,
},
{
label: 'Audit Logs',
href: `/org/${slug}/audit`,
},
{
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