diff --git a/ui/src/components/SidebarAccountMenu.production.tsx b/ui/src/components/SidebarAccountMenu.production.tsx index 738fcc7a62..c96aa2e2d1 100644 --- a/ui/src/components/SidebarAccountMenu.production.tsx +++ b/ui/src/components/SidebarAccountMenu.production.tsx @@ -12,6 +12,7 @@ import type { DeploymentMode } from "@paperclipai/shared"; import { Link } from "@/lib/router"; import { authApi } from "@/api/auth"; import { queryKeys } from "@/lib/queryKeys"; +import { useCloudInstance } from "@/hooks/useCloudInstance"; import { useSignOut } from "@/hooks/useSignOut"; import { useSidebar } from "../context/SidebarContext"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; @@ -106,6 +107,7 @@ export function SidebarAccountMenu({ open: controlledOpen, onOpenChange, }: SidebarAccountMenuProps) { + const isCloud = Boolean(useCloudInstance()); const [internalOpen, setInternalOpen] = useState(false); const { isMobile, setSidebarOpen, collapsed, peeking } = useSidebar(); const rail = collapsed && !peeking; @@ -227,7 +229,7 @@ export function SidebarAccountMenu({ - {!rail ? ( + {!rail && !isCloud ? ( { await flushReact(); await flushReact(); + expect(container.querySelector('a[aria-label="Share feedback"]')).not.toBeNull(); expect(container.textContent).toContain("Jane Example"); expect(container.textContent).not.toContain("jane@example.com"); @@ -274,7 +275,7 @@ describe("SidebarAccountMenu", () => { }); }); - it("navigates cloud-managed sign-out through the harness without calling local auth", async () => { + it.each([SidebarAccountMenu, ProductionSidebarAccountMenu])("hides cloud feedback and signs out through the harness (%#)", async (AccountMenu) => { const root = createRoot(container); const onOpenChange = vi.fn(); const queryClient = new QueryClient({ @@ -295,7 +296,7 @@ describe("SidebarAccountMenu", () => { root.render( - { }); await flushReact(); + expect(container.querySelector('a[aria-label="Share feedback"]')).toBeNull(); + const signOutButton = Array.from(document.body.querySelectorAll("button")).find( (button) => button.textContent?.includes("Sign out"), ); diff --git a/ui/src/components/SidebarAccountMenu.tsx b/ui/src/components/SidebarAccountMenu.tsx index 822080ad9f..199e8cbeee 100644 --- a/ui/src/components/SidebarAccountMenu.tsx +++ b/ui/src/components/SidebarAccountMenu.tsx @@ -13,6 +13,7 @@ import type { DeploymentMode } from "@paperclipai/shared"; import { Link } from "@/lib/router"; import { authApi } from "@/api/auth"; import { queryKeys } from "@/lib/queryKeys"; +import { useCloudInstance } from "@/hooks/useCloudInstance"; import { useSignOut } from "@/hooks/useSignOut"; import { useSidebar } from "../context/SidebarContext"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; @@ -112,6 +113,7 @@ export function SidebarAccountMenu({ onOpenChange, forceExpanded = false, }: SidebarAccountMenuProps) { + const isCloud = Boolean(useCloudInstance()); const [internalOpen, setInternalOpen] = useState(false); const { isMobile, setSidebarOpen, collapsed, peeking } = useSidebar(); const rail = collapsed && !peeking && !forceExpanded; @@ -230,7 +232,7 @@ export function SidebarAccountMenu({ - {!rail ? ( + {!rail && !isCloud ? (