mirror of
https://github.com/temetro/temetro.git
synced 2026-08-08 09:43:13 +00:00
frontend: make AI kill-switch a true clinic-wide master switch
The "Enable AI assistant" toggle already disabled the AI for everyone (including owners/admins) at the policy layer, but the copy read as an employee-only control and the Analysis surface stayed visible. Clarify that the master switch covers admins too, and close the gaps: hide the Analysis nav/command entry and redirect /analysis (alongside the chat home) to /patients when AI is disabled. The employee-only toggle remains the secondary option that keeps AI for owners/admins. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -56,9 +56,14 @@ export function AppAuthGuard({ children }: { children: ReactNode }) {
|
||||
router.replace(defaultLandingFor(role));
|
||||
return;
|
||||
}
|
||||
// AI kill-switch: the chat home ("/") is off for this user — send them to
|
||||
// patients (clinical roles always have it; non-clinical never land on "/").
|
||||
if (!aiLoading && !aiAllowed && pathname === "/") {
|
||||
// AI kill-switch: the AI surfaces — chat home ("/") and Analysis — are off
|
||||
// for this user (a full clinic disable also covers owners/admins). Send them
|
||||
// to patients (clinical roles always have it; non-clinical never land here).
|
||||
if (
|
||||
!aiLoading &&
|
||||
!aiAllowed &&
|
||||
(pathname === "/" || pathname === "/analysis")
|
||||
) {
|
||||
router.replace("/patients");
|
||||
}
|
||||
}, [ready, role, pathname, router, aiAllowed, aiLoading]);
|
||||
|
||||
Reference in New Issue
Block a user