'use client' import type { FC } from 'react' import React from 'react' import { useTranslation } from 'react-i18next' import { Plan } from '../type' import VectorSpaceInfo from '../usage-info/vector-space-info' import AppsInfo from '../usage-info/apps-info' import UpgradeBtn from '../upgrade-btn' import { User01 } from '../../base/icons/src/vender/line/users' import { MessageFastPlus } from '../../base/icons/src/vender/line/communication' import { FileUpload } from '../../base/icons/src/vender/line/files' import cn from '@/utils/classnames' import { useProviderContext } from '@/context/provider-context' import UsageInfo from '@/app/components/billing/usage-info' const typeStyle = { [Plan.sandbox]: { textClassNames: 'text-gray-900', bg: 'linear-gradient(113deg, rgba(255, 255, 255, 0.51) 3.51%, rgba(255, 255, 255, 0.00) 111.71%), #EAECF0', }, [Plan.professional]: { textClassNames: 'text-[#026AA2]', bg: 'linear-gradient(113deg, rgba(255, 255, 255, 0.51) 3.51%, rgba(255, 255, 255, 0.00) 111.71%), #E0F2FE', }, [Plan.team]: { textClassNames: 'text-[#3538CD]', bg: 'linear-gradient(113deg, rgba(255, 255, 255, 0.51) 3.51%, rgba(255, 255, 255, 0.00) 111.71%), #E0EAFF', }, [Plan.enterprise]: { textClassNames: 'text-[#DC6803]', bg: 'linear-gradient(113deg, rgba(255, 255, 255, 0.51) 3.51%, rgba(255, 255, 255, 0.00) 111.71%), #FFEED3', }, } type Props = { loc: string } const PlanComp: FC = ({ loc, }) => { const { t } = useTranslation() const { plan } = useProviderContext() const { type, } = plan const { usage, total, } = plan const isInHeader = loc === 'header' return (
{t('billing.currentPlan')}
{t(`billing.plans.${type}.name`)}
{(!isInHeader || (isInHeader && type !== Plan.sandbox)) && ( )}
{/* Plan detail */}
{isInHeader && type === Plan.sandbox && ( )}
) } export default React.memo(PlanComp)