"use client"; import type { SidebarNavSection } from "@app/app/navigation"; import { CommandPaletteTrigger } from "@app/components/command-palette/CommandPaletteTrigger"; import { OrgSelector } from "@app/components/OrgSelector"; import ProfileIcon from "@app/components/ProfileIcon"; import { SidebarNav } from "@app/components/SidebarNav"; import ThemeSwitcher from "@app/components/ThemeSwitcher"; import { Button } from "@app/components/ui/button"; import { Sheet, SheetContent, SheetDescription, SheetTitle, SheetTrigger } from "@app/components/ui/sheet"; import { useUserContext } from "@app/hooks/useUserContext"; import { cn } from "@app/lib/cn"; import { ListUserOrgsResponse } from "@server/routers/org"; import { Menu, Server, Settings, LayoutGrid } from "lucide-react"; import { useTranslations } from "next-intl"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useState } from "react"; interface LayoutMobileMenuProps { orgId?: string; orgs?: ListUserOrgsResponse["orgs"]; navItems: SidebarNavSection[]; showSidebar: boolean; showTopBar: boolean; launcherMode?: boolean; showViewAsAdmin?: boolean; } export function LayoutMobileMenu({ orgId, orgs, navItems, showSidebar, showTopBar, launcherMode = false, showViewAsAdmin = false }: LayoutMobileMenuProps) { const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); const pathname = usePathname(); const isAdminPage = pathname?.startsWith("/admin"); const { user } = useUserContext(); const t = useTranslations(); const showMobileNav = showSidebar || launcherMode; const currentOrg = orgs?.find((org) => org.orgId === orgId); const isSettingsPage = Boolean( orgId && pathname?.includes(`/${orgId}/settings`) ); const canViewResourceLauncher = Boolean( currentOrg?.isAdmin || currentOrg?.isOwner ); const mobileNavLinkClassName = cn( "flex items-center rounded transition-colors text-muted-foreground hover:text-foreground text-sm w-full hover:bg-secondary/50 dark:hover:bg-secondary/20 rounded-md px-3 py-1.5" ); return (