BranchLayout.tsx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { useParams } from 'common'
  2. import { useRouter } from 'next/router'
  3. import { PropsWithChildren } from 'react'
  4. import { ProjectLayout } from '../ProjectLayout'
  5. import { generateBranchMenu } from './BranchLayout.utils'
  6. import { GitHubStatus } from '@/components/interfaces/Settings/Integrations/GithubIntegration/GitHubStatus'
  7. import { ProductMenu } from '@/components/ui/ProductMenu'
  8. import { withAuth } from '@/hooks/misc/withAuth'
  9. const BranchProductMenu = () => {
  10. const router = useRouter()
  11. const { ref: projectRef = 'default' } = useParams()
  12. const page = router.pathname.split('/')[4] ?? 'branches'
  13. return (
  14. <>
  15. <ProductMenu page={page} menu={generateBranchMenu(projectRef)} />
  16. <div className="px-6">
  17. <h3 className="text-sm font-mono text-foreground-lighter uppercase mb-3">Configure</h3>
  18. <GitHubStatus />
  19. </div>
  20. </>
  21. )
  22. }
  23. const BranchLayout = ({ children }: PropsWithChildren<{}>) => {
  24. return (
  25. <ProjectLayout product="Branching" productMenu={<BranchProductMenu />} isBlocking={false}>
  26. {children}
  27. </ProjectLayout>
  28. )
  29. }
  30. export default withAuth(BranchLayout)