many fixes

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-06 14:31:42 +00:00
parent 4a16a6a402
commit c455a5ad83
21 changed files with 1497 additions and 242 deletions

View File

@@ -1,9 +1,10 @@
import { useEffect } from 'react';
import { useBillingStore } from '../../store/billingStore';
import ComponentCard from '../common/ComponentCard';
import Button from '../ui/button/Button';
export default function CreditBalanceWidget() {
const { balance, loading, loadBalance } = useBillingStore();
const { balance, loading, error, loadBalance } = useBillingStore();
useEffect(() => {
loadBalance();
@@ -16,6 +17,17 @@ export default function CreditBalanceWidget() {
</ComponentCard>
);
}
if (error && !balance) {
return (
<ComponentCard title="Credit Balance" desc="Balance unavailable">
<div className="text-sm text-red-600 dark:text-red-400 mb-3">{error}</div>
<Button variant="outline" size="sm" onClick={loadBalance}>
Retry
</Button>
</ComponentCard>
);
}
if (!balance) return null;
@@ -53,6 +65,11 @@ export default function CreditBalanceWidget() {
<span className="text-sm text-gray-600 dark:text-gray-400">Remaining</span>
<span className="text-sm font-medium text-success">{balance.credits_remaining}</span>
</div>
{error && (
<div className="mt-2 text-xs text-amber-600 dark:text-amber-400">
Balance may be outdated. {error}
</div>
)}
</div>
</div>
</ComponentCard>