Files
temetro/frontend/components/charts/tooltip/tooltip-content.tsx
T
Khalid Abdi 321a6298a4 frontend: pharmacy inventory, lab add-result & analysis charts
- Pharmacy: the sidebar entry now expands into Pharmacy + a new Inventory page
  (searchable medication stock with derived in-stock/low/out availability,
  backed by /api/inventory). Fix the dispensing-queue "Expiring" badge so it
  only flags courses ending within the next 7 days, not ones already elapsed.
- Lab "Add analysis result": the patient picker no longer lists patients until
  you type and supports arrow-key + Enter selection; the test field offers a
  catalog of common analyses with an Advanced option (custom analysis + ref
  range); submitted results now show immediately in a Recent results feed.
- Analysis: add a Live panel (real-time line chart) and replace the flat trend
  sparklines with bklit-ui area + bar charts (installed from the @bklit shadcn
  registry; chart CSS variables wired into the theme for light and dark).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 19:22:07 +03:00

63 lines
1.7 KiB
TypeScript

"use client";
import type { ReactNode } from "react";
import { intFmt } from "../chart-formatters";
export interface TooltipRow {
color: string;
label: string;
value: string | number;
}
export interface TooltipContentProps {
title?: string;
rows: TooltipRow[];
/** Optional additional content (e.g., markers) */
children?: ReactNode;
}
export function TooltipContent({ title, rows, children }: TooltipContentProps) {
return (
<div className="overflow-hidden">
<div className="px-3 py-2.5">
{title && (
<div className="mb-2 font-medium text-chart-tooltip-foreground text-xs">
{title}
</div>
)}
<div className="space-y-1.5">
{rows.map((row) => (
<div
className="flex items-center justify-between gap-4"
key={`${row.label}-${row.color}`}
>
<div className="flex items-center gap-2">
<span
className="h-2.5 w-2.5 shrink-0 rounded-full"
style={{ backgroundColor: row.color }}
/>
<span className="text-chart-tooltip-muted text-sm">
{row.label}
</span>
</div>
<span className="font-medium text-chart-tooltip-foreground text-sm tabular-nums">
{typeof row.value === "number" ? intFmt(row.value) : row.value}
</span>
</div>
))}
</div>
{children && (
<div className="mt-2 transition-opacity duration-200 ease-out">
{children}
</div>
)}
</div>
</div>
);
}
TooltipContent.displayName = "TooltipContent";
export default TooltipContent;