mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
36 lines
935 B
TypeScript
36 lines
935 B
TypeScript
import { Button, IconGitBranch } from 'ui'
|
|
|
|
import { useSelectedOrganization } from 'hooks'
|
|
import { useAppUiStateSnapshot } from 'state/app'
|
|
import BranchingWaitlistPopover from './BranchingWaitlistPopover'
|
|
|
|
import { OPT_IN_TAGS } from 'lib/constants'
|
|
|
|
interface EnableBranchingButtonProps {
|
|
alt?: boolean
|
|
}
|
|
|
|
const EnableBranchingButton = ({ alt = false }: EnableBranchingButtonProps) => {
|
|
const snap = useAppUiStateSnapshot()
|
|
const selectedOrg = useSelectedOrganization()
|
|
|
|
const hasAccessToBranching =
|
|
selectedOrg?.opt_in_tags?.includes(OPT_IN_TAGS.PREVIEW_BRANCHES) ?? false
|
|
|
|
if (!hasAccessToBranching) {
|
|
return <BranchingWaitlistPopover alt={alt} />
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
type={alt ? 'text' : 'default'}
|
|
icon={<IconGitBranch strokeWidth={1.5} />}
|
|
onClick={() => snap.setShowEnableBranchingModal(true)}
|
|
>
|
|
Enable branching
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
export default EnableBranchingButton
|