import { ChevronRight, X } from 'lucide-react'
import Link from 'next/link'
import { ReactNode } from 'react'
import { Button, cn, Collapsible, CollapsibleContent, CollapsibleTrigger, WarningIcon } from 'ui'
import { IS_PLATFORM } from '@/lib/constants'
const IPv4StatusIcon = ({ className, active }: { className?: string; active: boolean }) => {
return (
)
}
export interface IPv4Status {
type: 'error' | 'success'
title: string
description?: string | ReactNode
links?: { text: string; url: string }[]
}
interface IPv4StatusPanelProps {
method: 'direct' | 'transaction' | 'session'
ipv4Status: IPv4Status
projectRef: string
}
export function IPv4StatusPanel({ method, ipv4Status, projectRef }: IPv4StatusPanelProps) {
if (!IS_PLATFORM) return null
const links = ipv4Status.links ?? []
return (
{method === 'session' ? (
Only use on a IPv4 network
Session pooler connections are IPv4 proxied for free.
Use Direct Connection if connecting via an IPv6 network.
) : (
<>
{ipv4Status.title}
{ipv4Status.description &&
(typeof ipv4Status.description === 'string' ? (
{ipv4Status.description}
) : (
ipv4Status.description
))}
{links.length > 0 && (
{links.map((link) => (
))}
)}
{ipv4Status.type === 'error' && (
}
>
Some platforms are IPv4-only:
A few major platforms are IPv4-only and may not work with a Direct Connection:
Vercel
GitHub Actions
Render
Retool
If you wish to use a Direct Connection with these, please purchase{' '}
IPv4 support
.
You may also use the{' '}
Session Pooler or{' '}
Transaction Pooler if you are on
a IPv4 network.
)}
>
)}
)
}