feat: Wire AddAccountDialog and UpdateCredentialsDialog into health page and AccountCard

- health.tsx: Add Account button + AddAccountDialog, Refresh button with
  tooltip and spinner calling refreshAccounts mutation, inline account
  error state instead of full-page error, updated empty state text, and
  active-agent warning on delete confirm
- AccountCard.tsx: Show KeyRound button when credentials/token invalid,
  opens UpdateCredentialsDialog pre-populated with account identity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lukas May
2026-03-06 13:35:14 +01:00
parent b4baba67a5
commit a94e72ccbc
2 changed files with 125 additions and 49 deletions

View File

@@ -1,7 +1,9 @@
import { CheckCircle2, XCircle, AlertTriangle, Trash2 } from "lucide-react";
import { useState } from "react";
import { CheckCircle2, XCircle, AlertTriangle, Trash2, KeyRound } from "lucide-react";
import { Card, CardContent } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { UpdateCredentialsDialog } from "./UpdateCredentialsDialog";
function formatResetTime(isoDate: string): string {
const now = Date.now();
@@ -100,6 +102,7 @@ export function AccountCard({
account: AccountData;
onDelete?: (e: React.MouseEvent) => void;
}) {
const [updateCredOpen, setUpdateCredOpen] = useState(false);
const hasWarning = account.credentialsValid && !account.isExhausted && account.error;
const statusIcon = !account.credentialsValid ? (
@@ -123,6 +126,7 @@ export function AccountCard({
const usage = account.usage;
return (
<>
<Card>
<CardContent className="space-y-3 py-4">
{/* Header row */}
@@ -147,6 +151,17 @@ export function AccountCard({
<span>{statusText}</span>
</div>
</div>
{(!account.credentialsValid || !account.tokenValid) && (
<Button
variant="ghost"
size="icon"
className="shrink-0 text-muted-foreground hover:text-foreground"
onClick={() => setUpdateCredOpen(true)}
title="Update credentials"
>
<KeyRound className="h-4 w-4" />
</Button>
)}
{onDelete && (
<Button
variant="ghost"
@@ -220,5 +235,11 @@ export function AccountCard({
)}
</CardContent>
</Card>
<UpdateCredentialsDialog
open={updateCredOpen}
onOpenChange={setUpdateCredOpen}
account={{ id: account.id, email: account.email, provider: account.provider }}
/>
</>
);
}