feat(drill): ProviderDrawer with Overview tab + DrillDrawerHeader shell

This commit is contained in:
Tyler
2026-06-21 14:40:08 -06:00
parent 5b3b8619e6
commit 0678e25de7
7 changed files with 241 additions and 1 deletions
+26
View File
@@ -0,0 +1,26 @@
import { useQuery } from "@tanstack/react-query";
import { api } from "@/lib/api";
import type { Provider } from "@/types";
/**
* Per-provider detail drawer query (SP21 Task 2.2).
*
* Drives ``GET /api/config/providers/{npi}`` via ``api.getProvider``.
* The endpoint (added in Task 1.6) returns the full ``Provider`` shape
* with ``recent_claims`` and ``recent_activity`` arrays populated when
* the backend can serve them — Phase 3 will render those; Phase 2 only
* consumes the base fields.
*
* `npi === null` (drawer closed) disables the query so no fetch is
* issued. ``staleTime`` is 60 s — provider directory rows change
* infrequently, but we still want the drawer to refresh when a user
* reopens it across a long session.
*/
export function useProviderDetail(npi: string | null) {
return useQuery<Provider>({
queryKey: ["provider-detail", npi],
queryFn: () => api.getProvider(npi as string),
enabled: npi !== null,
staleTime: 60 * 1000,
});
}