'use client' import { Dialog, DialogTitle, DialogContent, DialogActions, Box, Typography, Button, LinearProgress, Chip } from '@mui/material' import { Favorite, AutoAwesome, Close as CloseIcon } from '@mui/icons-material' import { useTranslations, useLocale } from 'next-intl' import Link from 'next/link' interface UpgradeModalProps { open: boolean onClose: () => void limitData?: { limit: number remaining: number tier: string resetDate: string | null } } export default function UpgradeModal({ open, onClose, limitData }: UpgradeModalProps) { const locale = useLocale() const t = useTranslations('subscription.limitReached') const usagePercentage = limitData ? ((limitData.limit - limitData.remaining) / limitData.limit) * 100 : 100 const formatResetDate = (dateString: string | null) => { if (!dateString) { // If no reset date set, calculate 1 month from now const nextMonth = new Date() nextMonth.setMonth(nextMonth.getMonth() + 1) return nextMonth.toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' }) } const date = new Date(dateString) return date.toLocaleDateString(locale, { year: 'numeric', month: 'long', day: 'numeric' }) } return ( {t('title')} {/* Current Usage */} {limitData && ( {t('conversationsUsed')} {limitData.limit - limitData.remaining} / {limitData.limit} {t('resetsOn', { date: formatResetDate(limitData.resetDate) })} )} {/* Limit Reached Message */} {t('message')} {t('upgradePrompt')} {/* Premium Benefits */} {t('premiumTitle')} {t('benefits.unlimited')} {t('benefits.support')} {t('benefits.early')} $10 {t('pricing')} ) }