import { __ } from "@wordpress/i18n"; import type { UsageInfo } from "../data/types"; import styles from "./UsageCard.module.css"; interface Props { usage: UsageInfo; } function formatPlanName(plan: string): string { if (!plan) return ""; return plan.charAt(0).toUpperCase() + plan.slice(1); } export default function UsageCard({ usage }: Props) { const percentage = Math.min((usage.used / usage.limit) * 100, 100); const isNearLimit = usage.used / usage.limit >= 0.8; const renewsDate = new Date(usage.renewsAt); const formattedDate = renewsDate.toLocaleDateString(undefined, { month: "short", day: "numeric", year: "numeric", }); const barColor = isNearLimit ? "linear-gradient(90deg, #d63638, #a11d2b)" : "linear-gradient(90deg, #2271b1, #3582d4)"; return (