mirror of
https://github.com/temetro/temetro.git
synced 2026-08-31 12:58:08 +00:00
929bec8f31
Stop blocking AI imports/proposals on missing non-critical fields. Records the chat agent drafts now save with safe placeholders, auto-generated file numbers, and a source="ai" marker that surfaces an "Added by AI" badge so a clinician can review/edit them later. Backend: - add `source` (manual|ai) column to patients/appointments/prescriptions (migration 0014) + canonical types, services, validation schemas - relax patient/appointment validation: empty file number allowed, demographic + type/provider/initials fall back to placeholders (initials derived from name) - patients.generateFileNumber() auto-assigns an MRN when one is missing - proposeAppointment accepts a name when no file number resolves; AI commits + /api/ai/import stamp source="ai" Frontend: - `source` on Appointment/Patient/Prescription types; AI commits send source="ai" - reusable <AiBadge> shown on the Patients table/detail and prescriptions list Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.2 KiB
2.2 KiB
coss Toolbar
When to use
- Grouped command/action strips.
- Editor-like tool controls and mode toggles.
Install
npx shadcn@latest add @coss/toolbar
Manual deps from docs:
npm install @base-ui/react
Canonical imports
import { Button } from "@/components/ui/button"
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group"
import {
Toolbar,
ToolbarButton,
ToolbarGroup,
ToolbarSeparator,
} from "@/components/ui/toolbar"
Minimal pattern
<Toolbar>
<ToggleGroup className="border-none p-0" defaultValue={["left"]}>
<ToolbarButton aria-label="Align left" render={<ToggleGroupItem value="left" />}>
<AlignLeftIcon />
</ToolbarButton>
<ToolbarButton aria-label="Align center" render={<ToggleGroupItem value="center" />}>
<AlignCenterIcon />
</ToolbarButton>
</ToggleGroup>
<ToolbarSeparator />
<ToolbarGroup>
<ToolbarButton render={<Button type="button" variant="outline" />}>
Save
</ToolbarButton>
</ToolbarGroup>
</Toolbar>
Patterns from coss particles
- Part composition via
render: useToolbarButton render={<ToggleGroupItem ... />}orrender={<Button ... />}instead of re-implementing button behavior. - Grouped layout: use
ToolbarGroupboundaries withToolbarSeparatorbetween logical command clusters. - Icon-only controls: pair icon buttons with explicit
aria-label; combine withTooltipfor discoverability. - Embedded selects: wrap
SelectTriggerwithToolbarButton render={...}to keep visual consistency in mixed control bars. - Formatting rows: combine
ToggleGroup+ToolbarButtonfor alignment/formatting command sets.
Common pitfalls
- Dropping
ToolbarSeparator, causing unrelated command clusters to collapse visually. - Missing
aria-labelon icon-only toolbar actions. - Rendering raw
Button/ToggleGroupItemnext to toolbar controls withoutToolbarButton, creating inconsistent density/spacing. - Treating Toolbar as a state manager; control selection/toggle state through composed primitives (
ToggleGroup,Select, etc.).
Useful particle references
- core toolbar patterns:
p-toolbar-1 - related composition references:
p-toggle-group-1,p-group-1,p-select-1