mirror of
https://github.com/temetro/temetro.git
synced 2026-08-30 20:39:06 +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>
3.9 KiB
3.9 KiB
coss Sidebar
When to use
- Persistent app shell navigation and grouped links.
- Collapsible/structured side navigation for dashboard layouts.
Install
npx shadcn@latest add @coss/sidebar
Manual deps from docs:
npm install @base-ui/react
Canonical imports
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarGroup,
SidebarGroupAction,
SidebarGroupContent,
SidebarGroupLabel,
SidebarHeader,
SidebarInset,
SidebarMenu,
SidebarMenuButton,
SidebarMenuItem,
SidebarProvider,
SidebarRail,
SidebarSeparator,
SidebarTrigger,
useSidebar,
} from "@/components/ui/sidebar"
Minimal pattern
<SidebarProvider>
<Sidebar>
<SidebarHeader>Workspace</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Navigation</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton>Dashboard</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
</Sidebar>
<SidebarInset>{/* Main page content */}</SidebarInset>
</SidebarProvider>
Patterns from coss particles
Key patterns
Sidebar with grouped navigation and footer:
<SidebarProvider>
<Sidebar>
<SidebarHeader>
<h2 className="text-lg font-semibold">App Name</h2>
</SidebarHeader>
<SidebarContent>
<SidebarGroup>
<SidebarGroupLabel>Main</SidebarGroupLabel>
<SidebarGroupContent>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton render={<a href="/dashboard" />}>
Dashboard
</SidebarMenuButton>
</SidebarMenuItem>
<SidebarMenuItem>
<SidebarMenuButton render={<a href="/projects" />}>
Projects
</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarGroupContent>
</SidebarGroup>
</SidebarContent>
<SidebarFooter>
<SidebarMenu>
<SidebarMenuItem>
<SidebarMenuButton>Settings</SidebarMenuButton>
</SidebarMenuItem>
</SidebarMenu>
</SidebarFooter>
<SidebarRail />
</Sidebar>
<SidebarInset>{/* Page content */}</SidebarInset>
</SidebarProvider>
Key composition rules:
- Wrap app with
SidebarProviderat the layout level. - Use
SidebarContent(not "SidebarPanel") as the scrollable body between header/footer. It usesScrollAreawithfillso flex children (e.g.mt-autofooters) can pin to the bottom. - Navigation items use
SidebarMenu>SidebarMenuItem>SidebarMenuButton. - For link items, use
rendercomposition:<SidebarMenuButton render={<a href="..." />}>. Do not useasChild-- sidebar follows the samerenderpattern as all other coss primitives. - Use
SidebarTriggerfor the collapse/expand toggle. - Use
SidebarInsetfor the main content area next to the sidebar. SidebarRailadds a slim hover-to-expand rail in collapsed state.
More examples
See p-toolbar-1, p-breadcrumb-1, p-tabs-1, p-menu-1 for related app-shell patterns.
Common pitfalls
- Using non-existent parts like "SidebarPanel" or "SidebarItem" -- the correct names are
SidebarContentandSidebarMenuItem. - Forgetting
SidebarProviderwrapper, which manages collapse state and mobile responsiveness. - Skipping the
SidebarMenu>SidebarMenuItem>SidebarMenuButtonhierarchy for nav items. - Missing responsive collapse strategy for narrow/mobile layouts.
- Replacing
SidebarContent's scroll area with a rawScrollAreawithoutfillwhen the body usesmt-autoto pin footers—usefill(see scroll-area primitive docs).
Useful particle references
- sidebar-specific particles: no dedicated
p-sidebar-*family currently. - app-shell references:
p-toolbar-1,p-breadcrumb-1,p-tabs-1,p-menu-1