Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
fix(community): show sidebar-header server icon on mobile only
Gener87cc03cec066
diff --git a/src/web/src/components/community/channel-sidebar.crumb.test.ts b/src/web/src/components/community/channel-sidebar.crumb.test.tsnew file mode 100644index 000000000..30a810b41--- /dev/null+++ b/src/web/src/components/community/channel-sidebar.crumb.test.ts@@ -0,0 +1,58 @@+import { describe, it, expect, vi } from "vitest"+import { createElement } from "react"+import { renderToStaticMarkup } from "react-dom/server"++// The header's ServerCrumb is gated on the mobile breakpoint — mock the hook+// so each case renders deterministically without a DOM/matchMedia.+const isMobile = vi.fn<() => boolean>()+vi.mock("@/hooks/use-mobile", () => ({ useIsMobile: () => isMobile() }))++import { ChannelSidebar } from "./channel-sidebar"+import type { ChannelTree } from "./use-channel-tree"++// Minimal empty tree — the header renders regardless of channel content.+const emptyTree = {+ collapsed: new Set<string>(),+ catOrder: [],+ order: {},+ catNames: {},+ catPrivate: {},+ catPending: {},+ catCreators: {},+ toggleCat: vi.fn(),+ removeChannel: vi.fn(),+ renameChannel: vi.fn(),+ markRead: vi.fn(),+ renameCategory: vi.fn(),+ onDragOver: vi.fn(),+ onDragEnd: vi.fn(),+} as unknown as ChannelTree++const render = () =>+ renderToStaticMarkup(+ createElement(ChannelSidebar, {+ tree: emptyTree,+ serverName: "Alpha",+ serverIcon: null,+ serverId: "srv_1",+ activeChannel: "",+ setActiveChannel: vi.fn(),+ onOpenSettings: vi.fn(),+ }),+ )++describe("ChannelSidebar header ServerCrumb", () => {+ it("renders the server crumb on mobile (rail is hidden — sole identity marker)", () => {+ isMobile.mockReturnValue(true)+ // ServerCrumb is the only element that emits aria-label/title with the name.+ expect(render()).toContain('aria-label="Alpha"')+ })++ it("omits the server crumb on desktop (rail already shows the icon)", () => {+ isMobile.mockReturnValue(false)+ const html = render()+ expect(html).not.toContain('aria-label="Alpha"')+ // The server name itself still renders in the header text.+ expect(html).toContain("Alpha")+ })+})diff --git a/src/web/src/components/community/channel-sidebar.tsx b/src/web/src/components/community/channel-sidebar.tsxindex d646bb2b2..ec394793e 100644--- a/src/web/src/components/community/channel-sidebar.tsx+++ b/src/web/src/components/community/channel-sidebar.tsx@@ -18,6 +18,7 @@ import { catId, catOf, isCat, type ChannelTree } from "./use-channel-tree"import { InviteDialog } from "./invite-dialog"import { ChannelAddMembersDialog } from "./channel-add-members-dialog"import { ServerCrumb } from "./channel-header"+import { useIsMobile } from "@/hooks/use-mobile"import type { Channel, SettingsSection } from "./_types"import { UNCATEGORIZED_CATEGORY_ID, type ChannelType } from "@alook/shared"@@ -69,6 +70,10 @@ export const ChannelSidebar = memo(function ChannelSidebar({onInvitePopoverOpenChange?: (open: boolean) => void}) {const { collapsed, catOrder, order, catNames, catPrivate, catPending, toggleCat, removeChannel, renameChannel, renameCategory, onDragOver, onDragEnd: treeDragEnd } = tree+ // The server rail (with its own icon) is only visible on desktop, so the+ // header's ServerCrumb would double up there — show it only on mobile, where+ // the rail is hidden and this is the sole server identity marker.+ const isMobile = useIsMobile()// Category the dragged channel started in — captured at drag start, because// `onDragOver` mutates `order` mid-drag so by drop time it already reflects// the destination.@@ -231,7 +236,7 @@ export const ChannelSidebar = memo(function ChannelSidebar({{serverName && onOpenSettings ? (<DropdownMenu><DropdownMenuTrigger className="flex min-w-0 max-w-full items-center gap-2 rounded-md px-2 py-1 hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-none">- <ServerCrumb id={serverId ?? ""} name={serverName} icon={serverIcon ?? null} size={7} />+ {isMobile && <ServerCrumb id={serverId ?? ""} name={serverName} icon={serverIcon ?? null} size={7} />}<span className="min-w-0 truncate text-lg font-semibold">{serverName}</span><ChevronDown className="size-4 shrink-0 text-muted-foreground" /></DropdownMenuTrigger>@@ -245,7 +250,7 @@ export const ChannelSidebar = memo(function ChannelSidebar({</DropdownMenu>) : (<span className="flex min-w-0 max-w-full items-center gap-2 px-2">- {serverName && <ServerCrumb id={serverId ?? ""} name={serverName} icon={serverIcon ?? null} size={7} />}+ {isMobile && serverName && <ServerCrumb id={serverId ?? ""} name={serverName} icon={serverIcon ?? null} size={7} />}<span className="min-w-0 truncate text-lg font-semibold">{serverName || "\u00a0"}</span></span>)}