mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 11:25:06 +03:00
* Break me.tsx into smaller components * Deprecate duplicate app valtio state * Initialize feature preview modal * Add telemetry * Address comments
36 lines
962 B
TypeScript
36 lines
962 B
TypeScript
import { Button, IconGitBranch } from 'ui'
|
|
|
|
import { useSelectedOrganization } from 'hooks'
|
|
import BranchingWaitlistPopover from './BranchingWaitlistPopover'
|
|
|
|
import { OPT_IN_TAGS } from 'lib/constants'
|
|
import { useAppStateSnapshot } from 'state/app-state'
|
|
|
|
interface EnableBranchingButtonProps {
|
|
isNewNav?: boolean
|
|
}
|
|
|
|
const EnableBranchingButton = ({ isNewNav = false }: EnableBranchingButtonProps) => {
|
|
const snap = useAppStateSnapshot()
|
|
const selectedOrg = useSelectedOrganization()
|
|
|
|
const hasAccessToBranching =
|
|
selectedOrg?.opt_in_tags?.includes(OPT_IN_TAGS.PREVIEW_BRANCHES) ?? false
|
|
|
|
if (!hasAccessToBranching) {
|
|
return <BranchingWaitlistPopover isNewNav={isNewNav} />
|
|
}
|
|
|
|
return (
|
|
<Button
|
|
type={isNewNav ? 'default' : 'text'}
|
|
icon={<IconGitBranch strokeWidth={1.5} />}
|
|
onClick={() => snap.setShowEnableBranchingModal(true)}
|
|
>
|
|
Enable branching
|
|
</Button>
|
|
)
|
|
}
|
|
|
|
export default EnableBranchingButton
|