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