Skip to content

The open-source app everyone uses to manage agents at work

fix(ui): show the synced company logo on the Cloud org switcher trigger (#10917)

Dotta427509e6e006
diff --git a/ui/src/components/SidebarCompanyMenu.test.tsx b/ui/src/components/SidebarCompanyMenu.test.tsx
index 88fd4b7c89..c1c925d25e 100644
--- a/ui/src/components/SidebarCompanyMenu.test.tsx
+++ b/ui/src/components/SidebarCompanyMenu.test.tsx
@@ -84,6 +84,7 @@ vi.mock("@/context/CompanyContext", () => ({
issuePrefix: "PAP",
name: "Acme Labs",
brandColor: "#3366ff",
+ logoUrl: "/api/assets/logo-asset-1/content",
status: "active",
},
setSelectedCompanyId: mockSetSelectedCompanyId,
@@ -97,8 +98,8 @@ vi.mock("@/context/DialogContext", () => ({
}));
vi.mock("./CompanyPatternIcon", () => ({
- CompanyPatternIcon: ({ companyName }: { companyName: string }) => (
- <span aria-hidden="true">{companyName.slice(0, 1)}</span>
+ CompanyPatternIcon: ({ companyName, logoUrl }: { companyName: string; logoUrl?: string | null }) => (
+ <span aria-hidden="true" data-logo-url={logoUrl ?? undefined}>{companyName.slice(0, 1)}</span>
),
}));
@@ -497,6 +498,35 @@ describe("SidebarCompanyMenu", () => {
});
});
+ it("shows the synced company logo on the trigger while stack rows keep monograms", async () => {
+ const { root } = renderMenu({ cloud: true });
+ await flushReact();
+ await flushReact();
+
+ // A Cloud tenant holds exactly one company, and the harness pushes the
+ // stack's uploaded workspace icon into that company's branding — so the
+ // trigger renders the company logo, not the monogram.
+ const trigger = container.querySelector(
+ 'button[aria-label="Open Acme Labs organization switcher"]',
+ );
+ expect(trigger).not.toBeNull();
+ expect(
+ trigger?.querySelector('[data-logo-url="/api/assets/logo-asset-1/content"]'),
+ ).not.toBeNull();
+
+ // Other stacks have no hot-linkable icon in the portfolio payload, so
+ // their rows keep the deterministic monogram treatment.
+ await openMenu("Open Acme Labs organization switcher");
+ const strataRow = Array.from(document.body.querySelectorAll('[data-slot="dropdown-menu-item"]'))
+ .find((element) => element.textContent?.includes("Strata Systems"));
+ expect(strataRow).toBeTruthy();
+ expect(strataRow?.querySelector("[data-logo-url]")).toBeNull();
+
+ act(() => {
+ root.unmount();
+ });
+ });
+
it("enters another stack through a full top-level navigation", async () => {
const { root } = renderMenu({ cloud: true });
await flushReact();
diff --git a/ui/src/components/SidebarCompanyMenu.tsx b/ui/src/components/SidebarCompanyMenu.tsx
index 167c7b1f48..928b6e0bac 100644
--- a/ui/src/components/SidebarCompanyMenu.tsx
+++ b/ui/src/components/SidebarCompanyMenu.tsx
@@ -73,6 +73,29 @@ function StackIcon({ displayName }: { displayName: string }) {
return <CompanyPatternIcon companyName={displayName} className={WORKSPACE_ICON_CLASS} />;
}
+/**
+ * The switcher trigger on a Cloud instance. A Cloud tenant holds exactly one
+ * company and the harness pushes the stack's uploaded workspace icon into
+ * that company's branding, so the company logo is the stack logo here.
+ * The stack rows keep the monogram treatment above.
+ */
+function CurrentStackIcon({
+ displayName,
+ company,
+}: {
+ displayName: string;
+ company: Company | null;
+}) {
+ return (
+ <CompanyPatternIcon
+ companyName={displayName}
+ logoUrl={company?.logoUrl}
+ brandColor={company?.brandColor}
+ className={WORKSPACE_ICON_CLASS}
+ />
+ );
+}
+
function CloudStackItem({
stack,
isSelected,
@@ -336,7 +359,7 @@ export function SidebarCompanyMenu({ open: controlledOpen, onOpenChange }: Sideb
>
<span className="flex min-w-0 flex-1 items-center gap-2">
{isCloud
- ? currentName ? <StackIcon displayName={currentName} /> : null
+ ? currentName ? <CurrentStackIcon displayName={currentName} company={selectedCompany} /> : null
: selectedCompany ? <WorkspaceIcon company={selectedCompany} /> : null}
{/* The header has room for ~110px of name beside the collapse
control (~142px on mobile, which hides it) — search moved to