Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

881 B
Raw Blame
"use client";

import { cn } from "@/shared/utils/cn";
import { getBarColor } from "./utils";

interface Props {
  /** Remaining percentage (0-100). Lower = worse. */
  percent: number;
  /** Visual height — h-1 (4px, default) or h-1.5 (6px). */
  size?: "xs" | "sm";
  className?: string;
}

export default function QuotaMiniBar({ percent, size = "xs", className }: Props) {
  const colors = getBarColor(percent);
  const heightCls = size === "sm" ? "h-1.5" : "h-1";
  return (
    <div
      className={cn(
        "rounded-full overflow-hidden bg-black/[0.06] dark:bg-white/[0.06]",
        heightCls,
        className
      )}
    >
      <div
        className="h-full rounded-full transition-[width] duration-300 ease-out"
        style={{
          width: `${Math.min(100, Math.max(0, percent))}%`,
          background: colors.bar,
        }}
      />
    </div>
  );
}