'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { GoldCoin } from '../../base/icons/src/vender/solid/FinanceAndECommerce' import { Sparkles } from '../../base/icons/src/public/billing' import s from './style.module.css' import cn from '@/utils/classnames' import { useModalContext } from '@/context/modal-context' type Props = { className?: string isFull?: boolean size?: 'md' | 'lg' isPlain?: boolean isShort?: boolean onClick?: () => void loc?: string } const PlainBtn = ({ className, onClick }: { className?: string; onClick: () => void }) => { const { t } = useTranslation() return (
{t('billing.upgradeBtn.plain')}
) } const UpgradeBtn: FC = ({ className, isPlain = false, isFull = false, isShort = false, size = 'md', onClick: _onClick, loc, }) => { const { t } = useTranslation() const { setShowPricingModal } = useModalContext() const handleClick = () => { if (_onClick) _onClick() else (setShowPricingModal as any)() } const onClick = () => { handleClick() if (loc && (window as any).gtag) { (window as any).gtag('event', 'click_upgrade_btn', { loc, }) } } if (isPlain) return return (
{t(`billing.upgradeBtn.${isShort ? 'encourageShort' : 'encourage'}`)}
) } export default React.memo(UpgradeBtn)