mirror of
https://github.com/temetro/temetro.git
synced 2026-08-08 01:33:12 +00:00
a4f692d59d
Mirror the backend role changes (drop viewer, add pharmacy + lab and the lab statement). Replace the binary requiresClinical gating with access areas (clinical / pharmacy / lab) probed from Better Auth permissions — prescription:delete marks full clinicians, prescription:write the pharmacy area, lab:write the lab area — so pharmacy doesn't inherit the AI chat or notes. Pharmacy and lab land on their new dashboards and get their own nav items; reception behavior is unchanged. Includes the i18n keys for the new pages and the messages polish that lands in the following commits. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
119 lines
2.8 KiB
TypeScript
119 lines
2.8 KiB
TypeScript
import {
|
|
BarChart3,
|
|
CalendarClock,
|
|
Cross,
|
|
FlaskConical,
|
|
History,
|
|
ListTodo,
|
|
type LucideIcon,
|
|
Mail,
|
|
NotebookPen,
|
|
Pill,
|
|
Plus,
|
|
Settings,
|
|
Users,
|
|
} from "lucide-react";
|
|
|
|
// Access areas gate routes/nav by role capability (probed against the Better
|
|
// Auth permissions in lib/access.ts — see canAccessArea in lib/roles.ts):
|
|
// - "clinical": full clinicians only (owner/admin/doctor/member).
|
|
// - "pharmacy": pharmacy + full clinicians.
|
|
// - "lab": lab + full clinicians.
|
|
// Defined here (not roles.ts) because roles.ts imports nav.ts.
|
|
export type AccessArea = "clinical" | "pharmacy" | "lab";
|
|
|
|
export type NavSubItem = {
|
|
id: string;
|
|
// i18n key resolved with t() at render time.
|
|
labelKey: string;
|
|
icon?: LucideIcon;
|
|
link: string;
|
|
// Hidden from roles outside this access area. See lib/roles.ts.
|
|
access?: AccessArea;
|
|
};
|
|
|
|
export type NavItem = {
|
|
id: string;
|
|
// i18n key resolved with t() at render time.
|
|
labelKey: string;
|
|
icon: LucideIcon;
|
|
link: string;
|
|
// Optional sub-pages revealed under this item in the sidebar.
|
|
subs?: NavSubItem[];
|
|
// Hidden from roles outside this access area. See lib/roles.ts.
|
|
access?: AccessArea;
|
|
};
|
|
|
|
// Single source of truth for the primary navigation. Consumed by the sidebar
|
|
// (components/sidebar-02/app-sidebar.tsx) and the command palette
|
|
// (components/command-palette.tsx) so the two never drift.
|
|
export const navItems: NavItem[] = [
|
|
{
|
|
id: "new-chat",
|
|
labelKey: "nav.newChat",
|
|
icon: Plus,
|
|
link: "/",
|
|
access: "clinical",
|
|
},
|
|
{
|
|
id: "patients",
|
|
labelKey: "nav.patients",
|
|
icon: Users,
|
|
link: "/patients",
|
|
subs: [
|
|
{ id: "patients-list", labelKey: "nav.patients", link: "/patients" },
|
|
{
|
|
id: "appointments",
|
|
labelKey: "nav.appointments",
|
|
icon: CalendarClock,
|
|
link: "/appointments",
|
|
},
|
|
{
|
|
id: "prescriptions",
|
|
labelKey: "nav.prescriptions",
|
|
icon: Pill,
|
|
link: "/prescriptions",
|
|
access: "clinical",
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: "analysis",
|
|
labelKey: "nav.analysis",
|
|
icon: BarChart3,
|
|
link: "/analysis",
|
|
access: "clinical",
|
|
},
|
|
{
|
|
id: "pharmacy",
|
|
labelKey: "nav.pharmacy",
|
|
icon: Cross,
|
|
link: "/pharmacy",
|
|
access: "pharmacy",
|
|
},
|
|
{
|
|
id: "lab",
|
|
labelKey: "nav.lab",
|
|
icon: FlaskConical,
|
|
link: "/lab",
|
|
access: "lab",
|
|
},
|
|
{ id: "messages", labelKey: "nav.messages", icon: Mail, link: "/messages" },
|
|
{
|
|
id: "notes",
|
|
labelKey: "nav.notes",
|
|
icon: NotebookPen,
|
|
link: "/notes",
|
|
access: "clinical",
|
|
},
|
|
{ id: "tasks", labelKey: "nav.tasks", icon: ListTodo, link: "/tasks" },
|
|
{
|
|
id: "activity",
|
|
labelKey: "nav.activity",
|
|
icon: History,
|
|
link: "/activity",
|
|
access: "clinical",
|
|
},
|
|
{ id: "settings", labelKey: "nav.settings", icon: Settings, link: "/settings" },
|
|
];
|