mirror of
https://github.com/temetro/temetro.git
synced 2026-08-10 02:29:58 +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>
76 lines
1.9 KiB
TypeScript
76 lines
1.9 KiB
TypeScript
"use client";
|
|
|
|
import { useId } from "react";
|
|
|
|
export interface DashTailStrokeProps {
|
|
/** SVG path `d` for the full series (single curved path). */
|
|
pathD: string | null;
|
|
/** Total length of `pathD` in user units. */
|
|
pathLength: number;
|
|
/** Path length at which the dashed tail begins. */
|
|
dashStartLength: number;
|
|
/** X coordinate (chart inner space) where the tail clip begins. */
|
|
dashStartX: number;
|
|
innerWidth: number;
|
|
innerHeight: number;
|
|
/** Stroke paint — solid color or gradient url. */
|
|
stroke: string;
|
|
strokeWidth: number;
|
|
dashArray: string;
|
|
}
|
|
|
|
export function DashTailStroke({
|
|
pathD,
|
|
pathLength,
|
|
dashStartLength,
|
|
dashStartX,
|
|
innerWidth,
|
|
innerHeight,
|
|
stroke,
|
|
strokeWidth,
|
|
dashArray,
|
|
}: DashTailStrokeProps) {
|
|
const clipPathId = useId().replace(/:/g, "");
|
|
|
|
if (!pathD || pathLength <= 0 || dashStartLength >= pathLength) {
|
|
return null;
|
|
}
|
|
|
|
const pad = strokeWidth * 2;
|
|
const tailWidth = Math.max(0, innerWidth - dashStartX + pad);
|
|
|
|
return (
|
|
<>
|
|
<defs>
|
|
<clipPath id={clipPathId}>
|
|
<rect
|
|
height={innerHeight + pad}
|
|
width={tailWidth}
|
|
x={dashStartX - strokeWidth}
|
|
y={-strokeWidth}
|
|
/>
|
|
</clipPath>
|
|
</defs>
|
|
{/* Solid head — same curved path, gradient/fade preserved */}
|
|
<path
|
|
d={pathD}
|
|
fill="none"
|
|
stroke={stroke}
|
|
strokeDasharray={`${dashStartLength} ${Math.max(1, pathLength - dashStartLength)}`}
|
|
strokeLinecap="round"
|
|
strokeWidth={strokeWidth}
|
|
/>
|
|
{/* Dashed tail — clipped to x ≥ dashStartX so dashes follow the curve */}
|
|
<path
|
|
clipPath={`url(#${clipPathId})`}
|
|
d={pathD}
|
|
fill="none"
|
|
stroke={stroke}
|
|
strokeDasharray={dashArray}
|
|
strokeLinecap="round"
|
|
strokeWidth={strokeWidth}
|
|
/>
|
|
</>
|
|
);
|
|
}
|