feat(aptmpt page - patient status badge added

This commit is contained in:
2025-10-30 21:54:02 +05:30
parent 54f83ab398
commit a19c246ddb
2 changed files with 72 additions and 7 deletions

View File

@@ -0,0 +1,55 @@
import * as React from "react";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { PatientStatus } from "@repo/db/types";
export function PatientStatusBadge({
status,
className = "",
size = 10,
}: {
status: PatientStatus;
className?: string;
size?: number; // px
}) {
const { bg, label } = getVisuals(status);
return (
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<span
aria-label={`Patient status: ${label}`}
className={`inline-block rounded-full ring-2 ring-white shadow ${className}`}
style={{
width: size,
height: size,
backgroundColor: bg,
position: "absolute",
top: "-6px", // stick out above card
right: "-6px", // stick out right
}}
/>
</TooltipTrigger>
<TooltipContent side="top" className="px-2 py-1 text-xs">
{label}
</TooltipContent>
</Tooltip>
</TooltipProvider>
);
}
function getVisuals(status: PatientStatus): { label: string; bg: string } {
switch (status) {
case "ACTIVE":
return { label: "Active", bg: "#16A34A" }; // MEDICAL GREEN (not same as staff green)
case "INACTIVE":
return { label: "Inactive", bg: "#DC2626" }; // ALERT RED (distinct from card red)
default:
return { label: "Unknown", bg: "#6B7280" }; // solid gray
}
}