"use client";
import {
Sidebar,
SidebarContent,
SidebarFooter,
SidebarHeader,
SidebarTrigger,
useSidebar,
} from "@/components/ui/sidebar";
import {
Tooltip,
TooltipPopup,
TooltipTrigger,
} from "@/components/ui/tooltip";
import { cn } from "@/lib/utils";
import { useAiAccess } from "@/lib/ai-policy";
import { dirFor } from "@/lib/i18n/config";
import { useActiveRole, visibleNavItems } from "@/lib/roles";
import { motion } from "framer-motion";
import Image from "next/image";
import { useTranslation } from "react-i18next";
import type { Route } from "./nav-main";
import DashboardNavigation from "@/components/sidebar-02/nav-main";
import { NotificationsPopover } from "@/components/sidebar-02/nav-notifications";
import { NavUser } from "@/components/sidebar-02/nav-user";
import { useCallInvites } from "@/components/meetings/use-call-invites";
export function DashboardSidebar() {
const { state } = useSidebar();
const { t, i18n } = useTranslation();
// Anchor the sidebar to the right for RTL locales (Arabic) so the whole shell
// mirrors instead of leaving the fixed sidebar pinned physically left.
const side = dirFor(i18n.language) === "rtl" ? "right" : "left";
const role = useActiveRole();
const { allowed: aiAllowed } = useAiAccess();
const isCollapsed = state === "collapsed";
// Ring staff into calls from anywhere in the app.
useCallInvites();
// Hide clinical nav from non-clinical roles (e.g. reception). See lib/roles.ts.
// Also drop the AI surfaces ("New chat" + "Analysis") when the clinic's AI
// kill-switch applies — a full disable hides them for owners/admins too.
const dashboardRoutes: Route[] = visibleNavItems(role)
.filter(
(item) => aiAllowed || (item.id !== "new-chat" && item.id !== "analysis"),
)
.map((item) => ({
id: item.id,
title: t(item.labelKey),
icon: ,
link: item.link,
subs: item.subs?.map((sub) => ({
title: t(sub.labelKey),
link: sub.link,
icon: sub.icon ? : undefined,
})),
}));
return (
{/* White fox mark — inverted to black in light mode. */}
}
/>
temetro
);
}