Add budget tabs and sidebar budget indicators

This commit is contained in:
Dotta
2026-03-16 08:12:38 -05:00
parent 76e6cc08a6
commit 411952573e
7 changed files with 224 additions and 112 deletions

View File

@@ -185,10 +185,11 @@ function scrollToContainerBottom(container: ScrollContainer, behavior: ScrollBeh
container.scrollTo({ top: container.scrollHeight, behavior });
}
type AgentDetailView = "dashboard" | "configuration" | "runs";
type AgentDetailView = "dashboard" | "configuration" | "runs" | "budget";
function parseAgentDetailView(value: string | null): AgentDetailView {
if (value === "configure" || value === "configuration") return "configuration";
if (value === "budget") return "budget";
if (value === "runs") return value;
return "dashboard";
}
@@ -638,6 +639,7 @@ export function AgentDetail() {
{ value: "dashboard", label: "Dashboard" },
{ value: "configuration", label: "Configuration" },
{ value: "runs", label: "Runs" },
{ value: "budget", label: "Budget" },
]}
value={activeView}
onValueChange={(value) => navigate(`/agents/${canonicalAgentRef}/${value}`)}
@@ -645,15 +647,6 @@ export function AgentDetail() {
</Tabs>
)}
{!urlRunId && resolvedCompanyId ? (
<BudgetPolicyCard
summary={agentBudgetSummary}
isSaving={budgetMutation.isPending}
compact
onSave={(amount) => budgetMutation.mutate(amount)}
/>
) : null}
{actionError && <p className="text-sm text-destructive">{actionError}</p>}
{isPendingApproval && (
<p className="text-sm text-amber-500">
@@ -752,6 +745,17 @@ export function AgentDetail() {
adapterType={agent.adapterType}
/>
)}
{activeView === "budget" && resolvedCompanyId ? (
<div className="max-w-3xl">
<BudgetPolicyCard
summary={agentBudgetSummary}
isSaving={budgetMutation.isPending}
onSave={(amount) => budgetMutation.mutate(amount)}
variant="plain"
/>
</div>
) : null}
</div>
);
}