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(web): restore mobile thread header back
Gus11e6373b7d2d
diff --git a/src/web/src/components/community/channels/channel-header.navigation.test.ts b/src/web/src/components/community/channels/channel-header.navigation.test.tsindex e2696c3ff..e9be3b7cf 100644--- a/src/web/src/components/community/channels/channel-header.navigation.test.ts+++ b/src/web/src/components/community/channels/channel-header.navigation.test.ts@@ -41,6 +41,35 @@ describe("ChannelHeader hierarchy navigation", () => {expect(renderer.root.findAllByProps({ "aria-label": "Back" })).toHaveLength(0)})+ it("replaces the mobile child server control with one narrow direct-parent Back", () => {+ const onNavigateServer = vi.fn()+ const onNavigateParent = vi.fn()+ const renderer = render({+ mobileServer: { id: "s1", name: "Studio", icon: null, onNavigate: onNavigateServer },+ onBack: onNavigateParent,+ breadcrumb: {+ id: "c1",+ label: "Thread title",+ onNavigate: onNavigateParent,+ onRename: vi.fn(),+ },+ })++ expect(renderer.root.findAllByProps({+ "data-testid": tid.channelHeaderServer("s1"),+ })).toHaveLength(0)+ const back = renderer.root.findByProps({ "aria-label": "Back" })+ expect(back.props.className).toContain("h-11")+ expect(back.props.className).toContain("w-8")+ expect(back.props.className).toContain("sm:hidden")+ const rename = renderer.root.findByProps({ "aria-label": "Rename" })+ expect(rename.props.className).toContain("hidden")+ expect(rename.props.className).toContain("sm:inline-flex")+ act(() => back.props.onClick())+ expect(onNavigateParent).toHaveBeenCalledOnce()+ expect(onNavigateServer).not.toHaveBeenCalled()+ })+it("preserves an uploaded server image inside the 24px mobile visual", () => {const renderer = render({mobileServer: {diff --git a/src/web/src/components/community/channels/channel-header.tsx b/src/web/src/components/community/channels/channel-header.tsxindex bb5a7ba57..6aa2e3873 100644--- a/src/web/src/components/community/channels/channel-header.tsx+++ b/src/web/src/components/community/channels/channel-header.tsx@@ -78,6 +78,7 @@ export function ChannelHeader({// is `<EntityIcon kind={...}>`. The `<ChannelIcon>` breadcrumb SEPARATOR// below is a different glyph — leave it.const entityKind = forum ? "forum" : "text"+ const usesMobileParentBack = Boolean(onBack && mobileServer && breadcrumb)const tool = (k: Exclude<RightPanel, null>, Icon: LucideIcon, label: string) => (<Buttonvariant="ghost"@@ -94,7 +95,18 @@ export function ChannelHeader({{onBack && !mobileServer && (<Button variant="ghost" size="icon-sm" onClick={onBack} className="text-muted-foreground hover:text-foreground" aria-label="Back"><ChevronLeft className="size-5" /></Button>)}- {mobileServer && <MobileServerCrumb id={mobileServer.id} name={mobileServer.name} icon={mobileServer.icon} onNavigate={mobileServer.onNavigate} />}+ {usesMobileParentBack && (+ <Button+ variant="ghost"+ size="icon"+ onClick={onBack}+ className="h-11 w-8 shrink-0 text-muted-foreground hover:text-foreground sm:hidden"+ aria-label="Back"+ >+ <ChevronLeft className="size-5" />+ </Button>+ )}+ {mobileServer && !usesMobileParentBack && <MobileServerCrumb id={mobileServer.id} name={mobileServer.name} icon={mobileServer.icon} onNavigate={mobileServer.onNavigate} />}{server && <ServerCrumb id={server.id} name={server.name} icon={server.icon} size={6} className="ml-1" />}{breadcrumb ? (<>@@ -112,7 +124,12 @@ export function ChannelHeader({{breadcrumb.label}</span>{breadcrumb.onRename && (- <BreadcrumbRename label={breadcrumb.label} onRename={breadcrumb.onRename} titleMode={breadcrumb.titleRename} />+ <BreadcrumbRename+ label={breadcrumb.label}+ onRename={breadcrumb.onRename}+ titleMode={breadcrumb.titleRename}+ className={usesMobileParentBack ? "hidden sm:inline-flex" : undefined}+ />)}</>) : (@@ -267,7 +284,12 @@ function ChannelNotifDropdown({ level, onSetLevel }: {)}-function BreadcrumbRename({ label, onRename, titleMode = false }: { label: string; onRename: (name: string) => void | Promise<void>; titleMode?: boolean }) {+function BreadcrumbRename({ label, onRename, titleMode = false, className = "" }: {+ label: string+ onRename: (name: string) => void | Promise<void>+ titleMode?: boolean+ className?: string+}) {const [open, setOpen] = useState(false)const [draft, setDraft] = useState(label)const [saving, setSaving] = useState(false)@@ -302,7 +324,7 @@ function BreadcrumbRename({ label, onRename, titleMode = false }: { label: strin}return (<>- <Button variant="ghost" size="icon-sm" onClick={() => { setDraft(label); setOpen(true) }} className="text-muted-foreground hover:text-foreground" aria-label={titleMode ? "Edit post title" : "Rename"}>+ <Button variant="ghost" size="icon-sm" onClick={() => { setDraft(label); setOpen(true) }} className={`text-muted-foreground hover:text-foreground ${className}`} aria-label={titleMode ? "Edit post title" : "Rename"}><Pencil className="size-3.5" /></Button>{open && (diff --git a/src/web/src/components/community/channels/thread-channel-surface.test.ts b/src/web/src/components/community/channels/thread-channel-surface.test.tsindex 2a45fd933..16f053425 100644--- a/src/web/src/components/community/channels/thread-channel-surface.test.ts+++ b/src/web/src/components/community/channels/thread-channel-surface.test.ts@@ -326,7 +326,7 @@ describe("ThreadChannelSurface ownership", () => {mockedUseChannelMessageFeed.mockReturnValue(feed({ isLoading: false, isError: true }))act(() => renderer.update(React.createElement(ThreadChannelSurface, props)))const headerProps = mockedChannelHeader.mock.calls.at(-1)![0]- expect(headerProps).not.toHaveProperty("onBack")+ expect(headerProps.onBack).toBe(props.onNavigateParent)expect(headerProps.mobileServer).toBe(props.headerServer)expect(headerProps.breadcrumb).toEqual(expect.objectContaining({id: "parent_1",@@ -347,8 +347,8 @@ describe("ThreadChannelSurface ownership", () => {notifLevel: "default",onSetNotifLevel: props.onSetNotificationLevel,mobileServer: props.headerServer,+ onBack: props.onNavigateParent,}))- expect(headerProps).not.toHaveProperty("onBack")expect(headerProps.breadcrumb).toEqual(expect.objectContaining({id: "parent_1",label: "Thread name",diff --git a/src/web/src/components/community/channels/thread-channel-surface.tsx b/src/web/src/components/community/channels/thread-channel-surface.tsxindex 27c3dd5a9..3841e89c6 100644--- a/src/web/src/components/community/channels/thread-channel-surface.tsx+++ b/src/web/src/components/community/channels/thread-channel-surface.tsx@@ -206,6 +206,7 @@ export function ThreadChannelSurface({notifLevel={notificationLevel}onSetNotifLevel={onSetNotificationLevel}mobileServer={headerServer}+ onBack={onNavigateParent}tools={{ threads: false }}breadcrumb={parentChannelId ? {id: parentChannelId,diff --git a/src/web/src/test/e2e-ui/08-mobile.spec.ts b/src/web/src/test/e2e-ui/08-mobile.spec.tsindex 19fabc2d9..0c177047e 100644--- a/src/web/src/test/e2e-ui/08-mobile.spec.ts+++ b/src/web/src/test/e2e-ui/08-mobile.spec.ts@@ -208,16 +208,18 @@ test.describe.serial("mobile layout", () => {await expect(page.getByRole("dialog").getByText("mobile child seq target")).toBeVisible()})- test("a flat child exposes direct parent and server hierarchy controls", async ({ asUser }) => {+ test("a flat child exposes direct parent breadcrumb and Back controls", async ({ asUser }) => {const { page } = await asUser("alice")await page.goto(`/c/channels/${serverId}/${childChannelId}`)const current = page.getByRole("banner").getByText("mobile-child", { exact: true })await expect(current).toBeVisible()expect(await current.evaluate((element) => element.tagName)).toBe("SPAN")- await expect(page.getByRole("button", { name: "Back" })).toHaveCount(0)+ const back = page.getByRole("button", { name: "Back" })+ await expect(back).toBeVisible()+ await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toHaveCount(0)const historyLength = await page.evaluate(() => history.length)- await page.getByTestId(tid.channelHeaderParent(channelId)).click()+ await back.click()await expect.poll(() => new URL(page.url()).pathname).toBe(`/c/channels/${serverId}/${channelId}`,)@@ -225,12 +227,13 @@ test.describe.serial("mobile layout", () => {await page.goto(`/c/channels/${serverId}/${childChannelId}`)await expect(current).toBeVisible()- const serverHistoryLength = await page.evaluate(() => history.length)- await page.getByTestId(tid.channelHeaderServer(serverId)).click()+ const parentHistoryLength = await page.evaluate(() => history.length)+ await page.getByTestId(tid.channelHeaderParent(channelId)).click()await expect.poll(() => new URL(page.url()).pathname).toBe(- `/c/channels/${serverId}`,+ `/c/channels/${serverId}/${channelId}`,)- expect(await page.evaluate(() => history.length)).toBe(serverHistoryLength)+ expect(await page.evaluate(() => history.length)).toBe(parentHistoryLength)+})test("Marked opens a child message on its canonical route without losing context", async ({ asUser }) => {diff --git a/src/web/src/test/e2e-ui/40-mobile-server-header-hierarchy.spec.ts b/src/web/src/test/e2e-ui/40-mobile-server-header-hierarchy.spec.tsindex 9e8484660..0a40f6aaa 100644--- a/src/web/src/test/e2e-ui/40-mobile-server-header-hierarchy.spec.ts+++ b/src/web/src/test/e2e-ui/40-mobile-server-header-hierarchy.spec.ts@@ -24,6 +24,14 @@ async function expectServerControl(page: Page, serverId: string) {return control}+async function expectParentBack(page: Page, serverId: string) {+ const back = page.getByRole("button", { name: "Back" })+ await expect(back).toBeVisible()+ await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toHaveCount(0)+ expect(await back.boundingBox()).toMatchObject({ width: 32, height: 44 })+ return back+}+test.describe.serial("mobile server header direct hierarchy", () => {let serverId: stringlet textId: string@@ -53,20 +61,28 @@ test.describe.serial("mobile server header direct hierarchy", () => {}})- test("thread and forum post expose direct parent, direct root, and inert current labels", async ({ asUser }) => {+ test("thread and forum post expose direct parent Back and inert current labels", async ({ asUser }) => {const { page } = await asUser("alice")for (const child of [{ id: threadId, parentId: textId },{ id: postId, parentId: forumId },]) {await page.goto(`/c/channels/${serverId}/${child.id}`, { waitUntil: "commit" })- await expectServerControl(page, serverId)+ const back = await expectParentBack(page, serverId)const parent = page.getByTestId(tid.channelHeaderParent(child.parentId))await expect(parent).toBeVisible()const current = page.getByRole("banner").locator("span[title]").first()await expect(current).toBeVisible()expect(await current.evaluate((element) => element.tagName)).toBe("SPAN")+ const backHistoryLength = await page.evaluate(() => history.length)+ await back.click()+ await expect.poll(() => new URL(page.url()).pathname).toBe(+ `/c/channels/${serverId}/${child.parentId}`,+ )+ expect(await page.evaluate(() => history.length)).toBe(backHistoryLength)++ await page.goto(`/c/channels/${serverId}/${child.id}`, { waitUntil: "commit" })const parentHistoryLength = await page.evaluate(() => history.length)await parent.click()await expect.poll(() => new URL(page.url()).pathname).toBe(@@ -74,11 +90,6 @@ test.describe.serial("mobile server header direct hierarchy", () => {)expect(await page.evaluate(() => history.length)).toBe(parentHistoryLength)- await page.goto(`/c/channels/${serverId}/${child.id}`, { waitUntil: "commit" })- const rootHistoryLength = await page.evaluate(() => history.length)- await page.getByTestId(tid.channelHeaderServer(serverId)).click()- await expect.poll(() => new URL(page.url()).pathname).toBe(`/c/channels/${serverId}`)- expect(await page.evaluate(() => history.length)).toBe(rootHistoryLength)}})@@ -87,16 +98,15 @@ test.describe.serial("mobile server header direct hierarchy", () => {await page.setViewportSize({ width: 639, height: 844 })await page.goto(`/c/channels/${serverId}/${threadId}`, { waitUntil: "commit" })await expect(page.getByTestId(tid.composerInput)).toBeVisible({ timeout: 20_000 })- await expectServerControl(page, serverId)+ await expectParentBack(page, serverId)await page.waitForTimeout(200)- await page.evaluate(({ composerTestId, serverTestId }) => {- const serverControl = document.querySelector(`[data-testid="${serverTestId}"]`)- Reflect.set(window, "__headerHierarchyBanner", serverControl?.closest("header[role=banner]"))+ await page.evaluate(({ composerTestId }) => {+ const backControl = document.querySelector('button[aria-label="Back"]')+ Reflect.set(window, "__headerHierarchyBanner", backControl?.closest("header[role=banner]"))Reflect.set(window, "__headerHierarchyComposer", document.querySelector(`[data-testid="${composerTestId}"]`))}, {composerTestId: tid.channelComposerShell,- serverTestId: tid.channelHeaderServer(serverId),})let communityRequests = 0let newSockets = 0@@ -107,24 +117,24 @@ test.describe.serial("mobile server header direct hierarchy", () => {const pathname = new URL(page.url()).pathnameawait page.setViewportSize({ width: 640, height: 844 })- await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toBeHidden()+ await expect(page.getByRole("button", { name: "Back" })).toBeHidden()+ await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toHaveCount(0)await expect(page.getByTestId(tid.channelComposerShell)).toBeVisible()- expect(await page.evaluate(({ composerTestId, serverTestId }) => ({- banner: Reflect.get(window, "__headerHierarchyBanner") === document.querySelector(`[data-testid="${serverTestId}"]`)?.closest("header[role=banner]"),+ expect(await page.evaluate(({ composerTestId }) => ({+ banner: Reflect.get(window, "__headerHierarchyBanner") === document.querySelector('button[aria-label="Back"]')?.closest("header[role=banner]"),composer: Reflect.get(window, "__headerHierarchyComposer") === document.querySelector(`[data-testid="${composerTestId}"]`),}), {composerTestId: tid.channelComposerShell,- serverTestId: tid.channelHeaderServer(serverId),})).toEqual({ banner: true, composer: true })await page.setViewportSize({ width: 639, height: 844 })- await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toBeVisible()- expect(await page.evaluate(({ composerTestId, serverTestId }) => ({- banner: Reflect.get(window, "__headerHierarchyBanner") === document.querySelector(`[data-testid="${serverTestId}"]`)?.closest("header[role=banner]"),+ await expect(page.getByRole("button", { name: "Back" })).toBeVisible()+ await expect(page.getByTestId(tid.channelHeaderServer(serverId))).toHaveCount(0)+ expect(await page.evaluate(({ composerTestId }) => ({+ banner: Reflect.get(window, "__headerHierarchyBanner") === document.querySelector('button[aria-label="Back"]')?.closest("header[role=banner]"),composer: Reflect.get(window, "__headerHierarchyComposer") === document.querySelector(`[data-testid="${composerTestId}"]`),}), {composerTestId: tid.channelComposerShell,- serverTestId: tid.channelHeaderServer(serverId),})).toEqual({ banner: true, composer: true })expect(new URL(page.url()).pathname).toBe(pathname)expect(communityRequests).toBe(0)