"use client" import { Coffee, Settings, X } from "lucide-react" import type React from "react" import { FaGithub } from "react-icons/fa" import { useDictionary } from "@/hooks/use-dictionary" import { formatMessage } from "@/lib/i18n/utils" interface QuotaLimitToastProps { type?: "request" | "token" used: number limit: number onDismiss: () => void onConfigModel?: () => void } export function QuotaLimitToast({ type = "request", used, limit, onDismiss, onConfigModel, }: QuotaLimitToastProps) { const dict = useDictionary() const isTokenLimit = type === "token" const formatNumber = (n: number) => n >= 1000 ? `${(n / 1000).toFixed(1)}k` : n.toString() const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === "Escape") { e.preventDefault() onDismiss() } } return (
{/* Close button */} {/* Title row with icon */}

{isTokenLimit ? dict.quota.tokenLimit : dict.quota.dailyLimit}

{formatMessage(dict.quota.usedOf, { used: formatNumber(used), limit: formatNumber(limit), })}
{/* Message */}

{isTokenLimit ? dict.quota.messageToken : dict.quota.messageApi}

{dict.quota.reset}

{" "} {/* Action buttons */}
{onConfigModel && ( )} {dict.quota.selfHost} {dict.quota.sponsor}
) }