polish(driver-pwa): error states, typed catch, drop dead avatar, terminal poll
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
1 parent
0fba967cd8
commit
15d7f34689
6 files changed
+30
-13
No files matched your search
@@ -10,14 +10,14 @@ import { Spinner } from "@/components/Spinner";
|
||||
export function BalancePage() {
|
||||
const nav = useNavigate();
|
||||
const clear = useAuth((s) => s.clear);
|
||||
const { data, isLoading } = useQuery({ queryKey: ["balance"], queryFn: getBalance });
|
||||
const { data, isLoading, isError, refetch } = useQuery({ queryKey: ["balance"], queryFn: getBalance });
|
||||
|
||||
const accounts = data?.accounts ?? [];
|
||||
const totalDebt = accounts.filter((a) => a.balance < 0).reduce((s, a) => s + a.balance, 0);
|
||||
|
||||
return (
|
||||
<div>
|
||||
<AppHeader initials="" />
|
||||
<AppHeader />
|
||||
<div className="card p-4 mb-4 text-center">
|
||||
<p className="text-muted text-xs mb-1">Общий долг</p>
|
||||
<p className={`text-2xl font-extrabold ${totalDebt < 0 ? "text-neg" : ""}`}>{formatMoney(totalDebt)}</p>
|
||||
@@ -25,6 +25,11 @@ export function BalancePage() {
|
||||
|
||||
{isLoading ? (
|
||||
<div className="flex justify-center py-10"><Spinner /></div>
|
||||
) : isError ? (
|
||||
<div className="text-center py-8">
|
||||
<p className="text-muted text-sm mb-3">Не удалось загрузить баланс</p>
|
||||
<button className="btn-ghost" onClick={() => refetch()}>Повторить</button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="mb-4">
|
||||
{accounts.map((a) => (
|
||||
|
||||
Reference in new issue
Block a user