diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx
index 670d442..7d4be7c 100644
--- a/src/components/Sidebar.tsx
+++ b/src/components/Sidebar.tsx
@@ -7,6 +7,7 @@ import {
Inbox as InboxIcon,
Layers,
LayoutDashboard,
+ LogOut,
Receipt,
Stethoscope,
Upload as UploadIcon,
@@ -14,6 +15,7 @@ import {
} from "lucide-react";
import { cn } from "@/lib/utils";
import { useReconciliation } from "@/hooks/useReconciliation";
+import { useAuth } from "@/auth/useAuth";
const nav = [
{ to: "/", label: "Dashboard", icon: LayoutDashboard, end: true },
@@ -188,25 +190,70 @@ export function Sidebar() {
{/* Operator card — always at the bottom. Ringed, mono id, the
- account role under the name. */}
+ account role under the name. The avatar initial + username +
+ role all come from `useAuth()` now (replaced the hardcoded
+ "Jordan K. / Administrator"); the Sign out button next to it
+ hits `authApi.logout` and drops the operator back at /login. */}
-
-
- JK
-
-
-
-
Jordan K.
-
- Administrator
-
-
-
+
);
}
+/**
+ * Bottom-of-sidebar identity card. Driven by `useAuth()` so the
+ * username + role update whenever the operator's session changes
+ * (e.g. an admin re-grants a role via the admin pages, or the
+ * session expires and a fresh login lands them back with a
+ * different username).
+ */
+function CurrentUserCard() {
+ const { user, logout } = useAuth();
+ if (!user) {
+ // Shouldn't happen — the route guard ensures the sidebar only
+ // mounts after auth is established. Render a harmless placeholder
+ // so the layout doesn't reflow if the context ever lags.
+ return (
+
+
+
Signed out
+
+ );
+ }
+ // Use the first letter of the username for the avatar monogram;
+ // fall back to "?" if the username is somehow empty.
+ const initial = user.username?.[0]?.toUpperCase() ?? "?";
+ return (
+
+
+ {initial}
+
+
+
+
{user.username}
+
+ {user.role}
+
+
+
+
+ );
+}
+
function SectionLabel({ children }: { children: React.ReactNode }) {
return (