mirror of
https://github.com/temetro/temetro.git
synced 2026-09-03 22:35:27 +00:00
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>
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
"use client";
|
||||
|
||||
import { motion, useSpring } from "motion/react";
|
||||
import { type SpringConfig, useChartConfig } from "../chart-config-context";
|
||||
import { chartCssVars } from "../chart-context";
|
||||
|
||||
export interface TooltipDotProps {
|
||||
x: number;
|
||||
y: number;
|
||||
visible: boolean;
|
||||
color: string;
|
||||
size?: number;
|
||||
strokeColor?: string;
|
||||
strokeWidth?: number;
|
||||
/** Per-chart override; falls back to `ChartConfigProvider.tooltipSpring`. */
|
||||
springConfig?: SpringConfig;
|
||||
/** Animate position with a spring. Default: true */
|
||||
animate?: boolean;
|
||||
}
|
||||
|
||||
export function TooltipDot({
|
||||
x,
|
||||
y,
|
||||
visible,
|
||||
color,
|
||||
size = 5,
|
||||
strokeColor = chartCssVars.background,
|
||||
strokeWidth = 2,
|
||||
springConfig,
|
||||
animate = true,
|
||||
}: TooltipDotProps) {
|
||||
const { tooltipSpring } = useChartConfig();
|
||||
const effectiveSpring = springConfig ?? tooltipSpring;
|
||||
const animatedX = useSpring(x, effectiveSpring);
|
||||
const animatedY = useSpring(y, effectiveSpring);
|
||||
|
||||
if (animate) {
|
||||
animatedX.set(x);
|
||||
animatedY.set(y);
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!animate) {
|
||||
return (
|
||||
<circle
|
||||
cx={x}
|
||||
cy={y}
|
||||
fill={color}
|
||||
r={size}
|
||||
stroke={strokeColor}
|
||||
strokeWidth={strokeWidth}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<motion.circle
|
||||
cx={animatedX}
|
||||
cy={animatedY}
|
||||
fill={color}
|
||||
r={size}
|
||||
stroke={strokeColor}
|
||||
strokeWidth={strokeWidth}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
TooltipDot.displayName = "TooltipDot";
|
||||
|
||||
export default TooltipDot;
|
||||
Reference in New Issue
Block a user