import React from 'react'; import { ClipboardList, User } from 'lucide-react'; import { Progress } from '../../../../components/ui/progress'; import type { GoalRow, GoalSource } from '../../../../utils/goalRow'; // One goal, as the drawing states it: what it is, where the number stands, a derived bar, the line that // says what moves it, and where it came from. // // PRESENTATIONAL, and that is deliberate rather than tidiness. It takes the finished sentences and calls // no service, so a test can render a reached goal, a goal that has not moved and a goal whose numbers // cannot make a bar, and assert directly which of them draws a bar at all. interface Props { row: GoalRow; source?: GoalSource; /** The opened goal draws its readings in place of the bar; the list keeps the bar. */ chart?: React.ReactNode; /** The staff chart draws the goal as its deck does: title, the numbers, a short bar, who set it. */ layout?: "staff"; } // The deck's provenance tag in the shared pill tones: the patient's own sage, this practice's blue, the rest muted. const WHO_TONE: Record, string> = { self: ' ak-pill--ok', here: ' ak-pill--info', elsewhere: '' }; const StaffGoalRow = ({ row, source }: Props) => (
{row.title} {(row.numbers || row.summary) &&

{row.numbers || row.summary}

} {row.progress && (
)} {source && {source.label}}
); export const GoalRowCard: React.FC = ({ row, source, chart, layout }) => layout === "staff" && chart === undefined ? ( ) : (
{row.title} {/* Tabular figures, because a column of readings that jitters as the digits change is harder to compare than one that does not. */} {row.currentLabel && ( {row.currentLabel} )}
{/* NO BAR WHEN THERE IS NOTHING TO DRAW ONE FROM. A goal with no direction or no target has no fraction, and a bar sitting at zero would say the patient has made no progress rather than that the goal cannot say. */} {chart !== undefined ? chart : row.progress && ( )} {row.summary && (

{row.summary}

)} {source && (

{source.selfSet ?

)}
); export default GoalRowCard;