import type { ReactNode } from 'react' import { RiGraduationCapFill, } from '@remixicon/react' import { useTranslation } from 'react-i18next' import { useProviderContext } from '@/context/provider-context' import { SparklesSoft } from '../../base/icons/src/public/common' import PremiumBadge, { PremiumBadgeButton } from '../../base/premium-badge' import { Plan } from '../../billing/type' type PlanBadgeProps = { plan: Plan allowHover?: boolean sandboxAsUpgrade?: boolean onClick?: () => void } function PlanBadgeShell({ size, color, allowHover, onClick, children, }: Pick & { size?: 's' | 'm' color: 'blue' | 'indigo' | 'gray' children: ReactNode }) { if (onClick) { return ( {children} ) } return ( {children} ) } export function PlanBadge({ plan, allowHover, sandboxAsUpgrade = false, onClick }: PlanBadgeProps) { const { isFetchedPlan, isEducationWorkspace } = useProviderContext() const { t } = useTranslation() if (!isFetchedPlan) return null if (plan === Plan.sandbox && sandboxAsUpgrade) { return ( ) } if (plan === Plan.sandbox) { return (
{plan}
) } if (plan === Plan.professional) { return (
{isEducationWorkspace &&
) } if (plan === Plan.team) { return (
{plan}
) } return null }