mirror of
https://github.com/temetro/temetro.git
synced 2026-08-04 16:08:24 +00:00
321a6298a4
- 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>
50 lines
1.3 KiB
TypeScript
50 lines
1.3 KiB
TypeScript
"use client";
|
|
|
|
import { curveMonotoneX } from "@visx/curve";
|
|
import { AreaClosed } from "@visx/shape";
|
|
import { useChartStable } from "./chart-context";
|
|
|
|
// biome-ignore lint/suspicious/noExplicitAny: d3 curve factory type
|
|
type CurveFactory = any;
|
|
|
|
export interface PatternAreaProps {
|
|
/** Key in data to use for y values */
|
|
dataKey: string;
|
|
/** Fill color or pattern URL (e.g. `url(#pattern-id)`) */
|
|
fill: string;
|
|
/** Curve function. Default: curveMonotoneX */
|
|
curve?: CurveFactory;
|
|
/** @deprecated Pattern fill is not clip-revealed; only the stroke `Area` animates. */
|
|
animate?: boolean;
|
|
}
|
|
|
|
/**
|
|
* Filled area using an SVG pattern (`url(#id)`).
|
|
* Pair with `PatternLines` in `AreaChart` children and an `Area` with `fillOpacity={0}` for the stroke line.
|
|
*/
|
|
export function PatternArea({
|
|
dataKey,
|
|
fill,
|
|
curve = curveMonotoneX,
|
|
}: PatternAreaProps) {
|
|
const { renderData, xScale, yScale, xAccessor } = useChartStable();
|
|
|
|
return (
|
|
<AreaClosed
|
|
curve={curve}
|
|
data={renderData}
|
|
fill={fill}
|
|
x={(d) => xScale(xAccessor(d)) ?? 0}
|
|
y={(d) => {
|
|
const v = d[dataKey];
|
|
return typeof v === "number" ? (yScale(v) ?? 0) : 0;
|
|
}}
|
|
yScale={yScale}
|
|
/>
|
|
);
|
|
}
|
|
|
|
PatternArea.displayName = "PatternArea";
|
|
|
|
export default PatternArea;
|