Files
supabase/apps/studio/components/interfaces/Database/Replication/EnableReplicationCallout.tsx
Ivan Vasilov 56de26fe22 chore: Migrate the monorepo to use Tailwind v4 (#45318)
This PR migrates the whole monorepo to use Tailwind v4:
- Removed `@tailwindcss/container-queries` plugin since it's included by
default in v4,
- Bump all instances of Tailwind to v4. Made minimal changes to the
shared config to remove non-supported features (`alpha` mentions),
- Migrate all apps to be compatible with v4 configs,
- Fix the `typography.css` import in 3 apps,
- Add missing rules which were included by default in v3,
- Run `pnpm dlx @tailwindcss/upgrade` on all apps, which renames a lot
of classes
- Rename all misnamed classes according to
https://tailwindcss.com/docs/upgrade-guide#renamed-utilities in all
apps.

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-04-30 10:53:24 +00:00

114 lines
3.7 KiB
TypeScript

import { useParams } from 'common'
import { useState } from 'react'
import { toast } from 'sonner'
import {
Button,
cn,
Dialog,
DialogContent,
DialogFooter,
DialogHeader,
DialogSection,
DialogSectionSeparator,
DialogTitle,
DialogTrigger,
} from 'ui'
import { Admonition } from 'ui-patterns'
import { DestinationType } from './DestinationPanel/DestinationPanel.types'
import { DocsButton } from '@/components/ui/DocsButton'
import { UpgradePlanButton } from '@/components/ui/UpgradePlanButton'
import { useCreateTenantSourceMutation } from '@/data/replication/create-tenant-source-mutation'
import { DOCS_URL } from '@/lib/constants'
const EnableReplicationModal = () => {
const { ref: projectRef } = useParams()
const [open, setOpen] = useState(false)
const { mutate: createTenantSource, isPending: creatingTenantSource } =
useCreateTenantSourceMutation({
onSuccess: () => {
toast.success('External replication has been successfully enabled!')
setOpen(false)
},
onError: (error) => {
toast.error(`Failed to enable external replication: ${error.message}`)
},
})
const onEnableReplication = async () => {
if (!projectRef) return console.error('Project ref is required')
createTenantSource({ projectRef })
}
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button type="primary" className="w-min">
Enable external replication
</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Enable external replication</DialogTitle>
</DialogHeader>
<DialogSectionSeparator />
<DialogSection className="flex flex-col gap-y-2 p-0!">
<Admonition
type="warning"
className="rounded-none border-0"
title="Replication is currently in Alpha"
>
<p className="text-sm leading-normal!">
This feature is in active development and may change as we gather feedback.
Availability and behavior can evolve while in Alpha.
</p>
<p className="text-sm leading-normal!">
Pricing has not been finalized yet. You can enable replication now; we'll announce
pricing later and notify you before any charges apply.
</p>
</Admonition>
</DialogSection>
<DialogFooter>
<Button type="default" disabled={creatingTenantSource} onClick={() => setOpen(false)}>
Cancel
</Button>
<Button type="primary" loading={creatingTenantSource} onClick={onEnableReplication}>
Enable external replication
</Button>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
export const EnableReplicationCallout = ({
type,
className,
hasAccess,
}: {
type?: DestinationType | null
className?: string
hasAccess: boolean
}) => {
return (
<div className={cn('border rounded-md p-4 md:p-12 flex flex-col gap-y-4', className)}>
<div className="flex flex-col gap-y-1">
<h4>Replicate data to external destinations in real time</h4>
<p className="text-sm text-foreground-light">
{hasAccess ? 'Enable external replication' : 'Upgrade to the Pro plan'} to start
replicating your database changes to {type ?? 'data warehouses and analytics platforms'}
</p>
</div>
<div className="flex gap-x-2">
{hasAccess ? (
<EnableReplicationModal />
) : (
<UpgradePlanButton source="replication" featureProposition="use replication" />
)}
<DocsButton href={`${DOCS_URL}/guides/database/replication#replication`} />
</div>
</div>
)
}