The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
chore: files changed app/src/components/settings/panels/ai/UsageLedgerSection.tsx
Steven Enamakeld43832cf7f13
diff --git a/app/src/components/settings/panels/ai/UsageLedgerSection.tsx b/app/src/components/settings/panels/ai/UsageLedgerSection.tsxindex 8a9d04abfa..f699c48cbb 100644--- a/app/src/components/settings/panels/ai/UsageLedgerSection.tsx+++ b/app/src/components/settings/panels/ai/UsageLedgerSection.tsx@@ -3,8 +3,10 @@* BackgroundLoopControls. Pure presentational component: all figures are* precomputed by the parent hook.*/+import { RefreshCw } from 'lucide-react';+import type { CreditTransaction, TeamUsage } from '../../../../services/api/creditsApi';-import Button from '../../../ui/Button';+import { Button, Card, EmptyState } from '../../../ui';import {formatCount,formatDateTime,@@ -64,20 +66,22 @@ export const UsageLedgerSection = ({scheduledCallsPerRemainingDollar: number | null;activeConnectionsCount: number;}) => (- <div className="rounded-lg border border-line bg-surface p-3">- <div className="flex items-center justify-between gap-3">- <div>- <div className="text-sm font-semibold text-content">- {t('settings.ai.recentUsageLedger')}- </div>- <div className="text-xs text-content-muted">{t('settings.ai.recentUsageLedgerDesc')}</div>- </div>- <Button type="button" variant="secondary" size="xs" onClick={onRefresh} disabled={loading}>- {t('common.reload')}- </Button>- </div>-- <div className="mt-3 grid grid-cols-2 gap-2 md:grid-cols-3">+ <div className="space-y-4">+ <Card+ title={t('settings.ai.recentUsageLedger')}+ description={t('settings.ai.recentUsageLedgerDesc')}+ headerRight={+ <Button+ type="button"+ variant="secondary"+ size="sm"+ leadingIcon={<RefreshCw className="h-3.5 w-3.5" aria-hidden />}+ onClick={onRefresh}+ disabled={loading}>+ {t('common.reload')}+ </Button>+ }>+ <div className="grid grid-cols-2 gap-2 p-4 lg:grid-cols-3"><MetricTilelabel={t('settings.ai.weekBudget')}value={usage ? formatUsd(usage.cycleBudgetUsd) : t('common.notAvailable')}@@ -123,13 +127,19 @@ export const UsageLedgerSection = ({formatCount(memoryPollsPerWeek))}/>- </div>-- <div className="mt-3 rounded-lg border border-line bg-surface-muted p-3">- <div className="text-[10px] font-semibold uppercase tracking-wide text-content-faint">- {t('settings.ai.budgetMath')}</div>- <div className="mt-2 grid gap-2">+ {latestSpend && (+ <div className="px-4 py-3 text-xs text-content-secondary">+ {t('settings.ai.latestSpend')+ .replace('{amount}', formatUsd(formatSpendAmount(latestSpend)))+ .replace('{time}', new Date(latestSpend.createdAt).toLocaleString())+ .replace('{action}', latestSpend.action)}+ </div>+ )}+ </Card>++ <div className="grid gap-4 xl:grid-cols-2">+ <Card title={t('settings.ai.budgetMath')}><FormulaRowlabel={t('settings.ai.rowsLeft')}value={@@ -203,14 +213,9 @@ export const UsageLedgerSection = ({: t('settings.ai.needUsageToEstimate')}/>- </div>- </div>+ </Card>- <div className="mt-3 rounded-lg border border-line bg-surface-muted p-3">- <div className="text-[10px] font-semibold uppercase tracking-wide text-content-faint">- {t('settings.ai.loopCallBudget')}- </div>- <div className="mt-2 grid gap-2">+ <Card title={t('settings.ai.loopCallBudget')}><FormulaRowlabel={t('settings.ai.composioSyncScans')}value={t('settings.ai.perWeek').replace(@@ -235,60 +240,41 @@ export const UsageLedgerSection = ({value={t('settings.ai.perWeekMax').replace('{count}', formatCount(memoryPollsPerWeek))}detail={t('settings.ai.memoryWorkerPollsDetail')}/>- </div>+ </Card></div>- {latestSpend && (- <div className="mt-3 rounded-md border border-line bg-surface-muted px-3 py-2 text-xs text-content-secondary">- {t('settings.ai.latestSpend')- .replace('{amount}', formatUsd(formatSpendAmount(latestSpend)))- .replace('{time}', new Date(latestSpend.createdAt).toLocaleString())- .replace('{action}', latestSpend.action)}- </div>- )}-- <div className="mt-3 space-y-3">- <div>- <div className="text-[10px] font-semibold uppercase tracking-wide text-content-faint">- {t('settings.ai.topActions')}- </div>- <div className="mt-1 space-y-1">- {actionSummary.length > 0 ? (- actionSummary.map(([action, count, total]) => (- <div- key={action}- className="flex items-center justify-between gap-2 text-xs text-content-secondary">- <span className="truncate font-mono">{action}</span>- <span className="shrink-0 text-content-muted">- {count} / {formatUsd(total)}- </span>- </div>- ))- ) : (- <div className="text-xs text-content-muted">{t('settings.ai.noSpendRows')}</div>- )}- </div>- </div>+ <div className="grid gap-4 md:grid-cols-2">+ <Card title={t('settings.ai.topActions')}>+ {actionSummary.length > 0 ? (+ actionSummary.map(([action, count, total]) => (+ <div+ key={action}+ className="flex items-center justify-between gap-3 px-4 py-2.5 text-xs text-content-secondary">+ <span className="truncate font-mono">{action}</span>+ <span className="shrink-0 tabular-nums text-content-muted">+ {count} / {formatUsd(total)}+ </span>+ </div>+ ))+ ) : (+ <EmptyState label={t('settings.ai.noSpendRows')} />+ )}+ </Card>- <div>- <div className="text-[10px] font-semibold uppercase tracking-wide text-content-faint">- {t('settings.ai.topHours')}- </div>- <div className="mt-1 space-y-1">- {hourSummary.length > 0 ? (- hourSummary.map(([hour, total]) => (- <div- key={hour}- className="flex items-center justify-between gap-2 text-xs text-content-secondary">- <span>{hour}</span>- <span className="font-mono text-content-muted">{formatUsd(total)}</span>- </div>- ))- ) : (- <div className="text-xs text-content-muted">{t('settings.ai.noHourlySpend')}</div>- )}- </div>- </div>+ <Card title={t('settings.ai.topHours')}>+ {hourSummary.length > 0 ? (+ hourSummary.map(([hour, total]) => (+ <div+ key={hour}+ className="flex items-center justify-between gap-3 px-4 py-2.5 text-xs text-content-secondary">+ <span>{hour}</span>+ <span className="font-mono tabular-nums text-content-muted">{formatUsd(total)}</span>+ </div>+ ))+ ) : (+ <EmptyState label={t('settings.ai.noHourlySpend')} />+ )}+ </Card></div></div>);