From 22b9eb59d2aab4eb13e59521e8b7bc7d3d99e8d7 Mon Sep 17 00:00:00 2001 From: Tyler Date: Fri, 19 Jun 2026 19:44:54 -0600 Subject: [PATCH] feat(frontend): refactor Providers page to useProviders + primitives --- src/pages/Providers.tsx | 121 ++++++++++++++++++++++++---------------- 1 file changed, 74 insertions(+), 47 deletions(-) diff --git a/src/pages/Providers.tsx b/src/pages/Providers.tsx index dfe8407..ab2d705 100644 --- a/src/pages/Providers.tsx +++ b/src/pages/Providers.tsx @@ -1,9 +1,13 @@ import { Building2, MapPin, Phone } from "lucide-react"; -import { useAppStore } from "@/store"; +import { Skeleton } from "@/components/ui/skeleton"; +import { EmptyState } from "@/components/ui/empty-state"; +import { ErrorState } from "@/components/ui/error-state"; +import { useProviders } from "@/hooks/useProviders"; import { fmt } from "@/lib/format"; export function Providers() { - const providers = useAppStore((s) => s.providers); + const { data, isLoading, isError, error, refetch } = useProviders(); + const items = data?.items ?? []; return (
@@ -19,60 +23,83 @@ export function Providers() {

-
- {providers.map((p) => ( -
-
-
- -
-
-

- {p.name} -

-

- NPI {p.npi} · TIN {p.taxId} -

-
-
+ {isError ? ( + refetch()} + /> + ) : null} -
-
- - - {p.address}, {p.city}, {p.state} {p.zip} - + {isLoading ? ( +
+ {Array.from({ length: 6 }).map((_, i) => ( + + ))} +
+ ) : items.length === 0 ? ( +
+ +
+ ) : ( +
+ {items.map((p) => ( +
+
+
+ +
+
+

+ {p.name} +

+

+ NPI {p.npi} · TIN {p.taxId} +

+
-
- - {p.phone} -
-
-
-
-
- Claims +
+
+ + + {p.address}, {p.city}, {p.state} {p.zip} +
-
- {fmt.num(p.claimCount)} +
+ + {p.phone}
-
-
- Outstanding AR + +
+
+
+ Claims +
+
+ {fmt.num(p.claimCount)} +
-
- {fmt.usd(p.outstandingAr)} +
+
+ Outstanding AR +
+
+ {fmt.usd(p.outstandingAr)} +
-
-
- ))} -
+ + ))} +
+ )} ); }