Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): correct profile scrolling and fullscreen thread back (#855)

Gustavo Ye18177178f36e
diff --git a/src/web/src/components/community/channels/channel-header.skeleton.test.ts b/src/web/src/components/community/channels/channel-header.skeleton.test.ts
index 15418eb30..8fd321f8e 100644
--- a/src/web/src/components/community/channels/channel-header.skeleton.test.ts
+++ b/src/web/src/components/community/channels/channel-header.skeleton.test.ts
@@ -5,6 +5,15 @@ import { tid } from "@/lib/community/testids"
import { ChannelHeaderSkeleton } from "./channel-header"
describe("ChannelHeaderSkeleton", () => {
+ it.each([false, true])("matches the thread Back footprint on desktop in compact mode %s", (compactActions) => {
+ const html = renderToStaticMarkup(createElement(ChannelHeaderSkeleton, { kind: "thread", compactActions }))
+ const leadingClasses = html.match(/data-slot="loading-mobile-leading"[^>]*class="([^"]*)"/)?.[1]
+
+ expect(leadingClasses).toContain("size-11")
+ expect(leadingClasses?.includes("sm:hidden")).toBe(compactActions)
+ expect(html).not.toContain("<button")
+ })
+
it("renders inert mobile Back geometry without interaction", () => {
const html = renderToStaticMarkup(createElement(ChannelHeaderSkeleton))
diff --git a/src/web/src/components/community/channels/channel-header.tsx b/src/web/src/components/community/channels/channel-header.tsx
index d1359f86d..89d5f245c 100644
--- a/src/web/src/components/community/channels/channel-header.tsx
+++ b/src/web/src/components/community/channels/channel-header.tsx
@@ -39,7 +39,7 @@ export function ChannelHeaderSkeleton({
data-testid={tid.messageHeaderLeadingLoading}
data-slot="loading-mobile-leading"
aria-hidden
- className="grid size-11 shrink-0 place-items-center sm:hidden"
+ className={`grid size-11 shrink-0 place-items-center ${kind === "thread" && !compactActions ? "" : "sm:hidden"}`}
>
<Skeleton className="size-6 rounded-md" />
</div>
diff --git a/src/web/src/components/community/channels/thread-channel-surface.dom.test.ts b/src/web/src/components/community/channels/thread-channel-surface.dom.test.ts
index c013ca283..7f485206c 100644
--- a/src/web/src/components/community/channels/thread-channel-surface.dom.test.ts
+++ b/src/web/src/components/community/channels/thread-channel-surface.dom.test.ts
@@ -248,6 +248,31 @@ describe("ThreadChannelSurface ownership", () => {
vi.clearAllMocks()
})
+ it.each([
+ { parentIsForum: false },
+ { parentIsForum: true },
+ ])("renders one Back control on desktop and returns to the parent for %o", async (overrides) => {
+ const { ChannelHeader: RealChannelHeader } = await vi.importActual<typeof import("./channel-header")>("./channel-header")
+ mockedChannelHeader.mockImplementationOnce(RealChannelHeader)
+ const onNavigateParent = vi.fn()
+ const view = render(renderSurface({ ...overrides, onNavigateParent }))
+
+ const back = view.getByRole("button", { name: "Back" })
+ expect(view.getAllByRole("button", { name: "Back" })).toHaveLength(1)
+ expect(back).toHaveClass("size-11")
+ expect(back).not.toHaveClass("sm:hidden")
+ fireEvent.click(back)
+ expect(onNavigateParent).toHaveBeenCalledOnce()
+ })
+
+ it("omits Back in the split thread header", async () => {
+ const { ChannelHeader: RealChannelHeader } = await vi.importActual<typeof import("./channel-header")>("./channel-header")
+ mockedChannelHeader.mockImplementationOnce(RealChannelHeader)
+ const view = render(renderSurface({ splitActions: { onFullscreen: vi.fn(), onClose: vi.fn() } }))
+
+ expect(view.queryByRole("button", { name: "Back" })).toBeNull()
+ })
+
it("owns the child feed and preserves opener, message-list, and composer wiring", () => {
const props = surfaceProps()
diff --git a/src/web/src/components/community/channels/thread-channel-surface.tsx b/src/web/src/components/community/channels/thread-channel-surface.tsx
index ee1954cf8..a26826381 100644
--- a/src/web/src/components/community/channels/thread-channel-surface.tsx
+++ b/src/web/src/components/community/channels/thread-channel-surface.tsx
@@ -216,7 +216,8 @@ export function ThreadChannelSurface({
onToggle={togglePanel}
notifLevel={notificationLevel}
onSetNotifLevel={onSetNotificationLevel}
- mobileBack={onNavigateParent}
+ mobileBack={splitActions ? undefined : onNavigateParent}
+ mobileBackDisplay="always"
tools={{ threads: false }}
titleRename={parentIsForum}
onRename={parentChannelId && !splitActions ? rename : undefined}
diff --git a/src/web/src/components/community/shell/shell-frame-view.tsx b/src/web/src/components/community/shell/shell-frame-view.tsx
index d1feb7f8f..e2646deae 100644
--- a/src/web/src/components/community/shell/shell-frame-view.tsx
+++ b/src/web/src/components/community/shell/shell-frame-view.tsx
@@ -90,6 +90,7 @@ export function ShellFrameView({
<ProfileRunningBotsCard
onOpenBotAudit={profile.openBotAudit}
useBackdropEffect={breakpoint !== "mobile"}
+ showShadow={breakpoint !== "mobile"}
/>
) : null
diff --git a/src/web/src/components/community/shell/user-bar-extension-slot.dom.test.tsx b/src/web/src/components/community/shell/user-bar-extension-slot.dom.test.tsx
index 413b0d1df..dc422f6f8 100644
--- a/src/web/src/components/community/shell/user-bar-extension-slot.dom.test.tsx
+++ b/src/web/src/components/community/shell/user-bar-extension-slot.dom.test.tsx
@@ -34,7 +34,7 @@ const machines = [{
}]
describe("UserBarExtensionSlot", () => {
- it("uses a real bounded mobile scroll container without shrinking either profile card", () => {
+ it("keeps the mobile primary card framed and gives only the companion the shrink budget", () => {
const renderer = render(createElement(UserBarExtensionSlot, {
active: "profile",
profile: createElement("div", { "data-testid": "profile-content" }, "Profile"),
@@ -55,13 +55,16 @@ describe("UserBarExtensionSlot", () => {
expect(slot.className).not.toContain("border-x")
expect(slot.className).not.toContain("border-t")
expect(scroller?.className).toContain("min-h-0")
- expect(scroller?.className).toContain("overflow-y-auto")
+ expect(scroller?.className).not.toContain("overflow-y-auto")
expect(scroller?.style.maxHeight).toContain("100dvh")
expect(renderer.getByTestId("profile-content").parentElement?.className).toContain("shrink-0")
+ expect(renderer.getByTestId("profile-content").parentElement?.className).toContain("bg-popover")
+ expect(renderer.getByTestId("profile-content").parentElement?.className).toContain("rounded-xl")
+ expect(renderer.getByTestId("profile-content").parentElement?.className).not.toContain("shadow-")
const companionSurface = renderer.getByTestId("profile-companion").parentElement
- expect(companionSurface?.className).toContain("shrink-0")
- expect(companionSurface?.className).toContain("-mx-2")
- expect(companionSurface?.className).toContain("mb-2")
+ expect(companionSurface?.className).toContain("min-h-0")
+ expect(companionSurface?.className).toContain("flex-col")
+ expect(companionSurface?.className).not.toContain("shrink-0")
})
it("disables dismissal and focus while retained for the closing animation", async () => {
diff --git a/src/web/src/components/community/shell/user-bar-extension-slot.tsx b/src/web/src/components/community/shell/user-bar-extension-slot.tsx
index bc536f0aa..9daa045bb 100644
--- a/src/web/src/components/community/shell/user-bar-extension-slot.tsx
+++ b/src/web/src/components/community/shell/user-bar-extension-slot.tsx
@@ -127,11 +127,11 @@ export function UserBarExtensionSlot({
{active === "inbox" && inbox}
{active === "profile" && (
<div
- className="flex min-h-0 flex-col gap-2 overflow-y-auto p-2 thin-scrollbar"
+ className={cn("flex min-h-0 flex-col gap-2", unframedMobileProfile ? "p-0" : "p-2")}
style={{ maxHeight: boundedHeight }}
>
- {profileCompanion && <div className="-mx-2 mb-2 shrink-0">{profileCompanion}</div>}
- <div className="shrink-0">{profile}</div>
+ {profileCompanion && <div className="flex min-h-0 flex-col">{profileCompanion}</div>}
+ <div className={cn("shrink-0", unframedMobileProfile && "overflow-hidden rounded-xl border border-border bg-popover p-2")}>{profile}</div>
</div>
)}
{active === "update" && update && (
diff --git a/src/web/src/components/community/shell/user-bar.test.ts b/src/web/src/components/community/shell/user-bar.test.ts
index f484c93ea..90c1d8bfa 100644
--- a/src/web/src/components/community/shell/user-bar.test.ts
+++ b/src/web/src/components/community/shell/user-bar.test.ts
@@ -20,7 +20,7 @@ describe("UserBar", () => {
expect(running).toContain(`data-testid="${tid.userBarRunningBotsGlow}"`)
expect(running).toContain('aria-label="Open profile. 2 running bots."')
expect(running).toContain("relative grid size-7 place-items-center rounded-full")
- expect(running).toContain("pointer-events-none absolute -inset-0.5")
+ expect(running).toContain("pointer-events-none absolute -inset-px")
expect(running).toContain("focus-visible:ring-offset-4")
expect(running).toContain("focus-visible:ring-offset-muted")
expect(running).toContain("var(--primary)")
diff --git a/src/web/src/components/community/shell/user-bar.tsx b/src/web/src/components/community/shell/user-bar.tsx
index 729b26c6d..4105dc6bd 100644
--- a/src/web/src/components/community/shell/user-bar.tsx
+++ b/src/web/src/components/community/shell/user-bar.tsx
@@ -227,7 +227,7 @@ function Inner({ breakpoint, user, onOpenProfile, onEditProfile, inbox, hasUnrea
<span
data-testid={tid.userBarRunningBotsRing}
aria-hidden
- className="pointer-events-none absolute -inset-0.5 rounded-full [background:conic-gradient(from_30deg,var(--link),var(--primary),var(--link))]"
+ className="pointer-events-none absolute -inset-px rounded-full [background:conic-gradient(from_30deg,var(--link),var(--primary),var(--link))]"
/>
</>
)}
diff --git a/src/web/src/components/community/social/profile-running-bots-card.dom.test.ts b/src/web/src/components/community/social/profile-running-bots-card.dom.test.ts
index 4263bf756..1dfede00f 100644
--- a/src/web/src/components/community/social/profile-running-bots-card.dom.test.ts
+++ b/src/web/src/components/community/social/profile-running-bots-card.dom.test.ts
@@ -160,10 +160,11 @@ describe("ProfileRunningBotsCard", () => {
expect(html).not.toContain("Online ·")
expect(html).not.toContain('presence="online"')
expect(html).toContain("px-4 py-2")
- expect(html).toContain("flex h-6 items-center gap-2")
+ expect(html).toContain("flex h-6 shrink-0 items-center gap-2")
expect(html).not.toContain("flex h-8 items-center")
expect(html).toContain("max-h-64")
expect(html).toContain("overflow-y-auto")
+ expect(html).toContain("overscroll-contain")
expect(html).toContain("thin-scrollbar")
expect(html).toContain("block truncate text-sm font-medium")
expect(html).toContain('<span class="truncate">')
@@ -178,9 +179,12 @@ describe("ProfileRunningBotsCard", () => {
}]])
const html = renderToStaticMarkup(createElement(ProfileRunningBotsCard, {
useBackdropEffect: false,
+ showShadow: false,
}))
expect(html).toContain("bg-popover/95")
+ expect(html).toContain("shadow-none")
+ expect(html).not.toContain("shadow-2xl")
expect(html).not.toContain("backdrop-blur-2xl")
expect(html).not.toContain("backdrop-saturate-150")
})
diff --git a/src/web/src/components/community/social/profile-running-bots-card.tsx b/src/web/src/components/community/social/profile-running-bots-card.tsx
index 1b744d0c0..1a4f88c17 100644
--- a/src/web/src/components/community/social/profile-running-bots-card.tsx
+++ b/src/web/src/components/community/social/profile-running-bots-card.tsx
@@ -61,9 +61,10 @@ function BotRow({ bot, onOpenBotAudit }: {
)
}
-export function ProfileRunningBotsCard({ onOpenBotAudit, useBackdropEffect = true }: {
+export function ProfileRunningBotsCard({ onOpenBotAudit, useBackdropEffect = true, showShadow = true }: {
onOpenBotAudit?: (botId: string) => void
useBackdropEffect?: boolean
+ showShadow?: boolean
}) {
const titleId = useId()
const { runningBots } = useRunningOwnedBots()
@@ -75,13 +76,14 @@ export function ProfileRunningBotsCard({ onOpenBotAudit, useBackdropEffect = tru
data-testid={tid.profileRunningBotsCard}
aria-labelledby={titleId}
className={[
- "relative isolate flex h-full min-h-0 w-full flex-col overflow-hidden rounded-2xl border border-foreground/10 px-4 py-2 text-popover-foreground shadow-2xl shadow-black/20 before:pointer-events-none before:absolute before:inset-x-5 before:top-0 before:z-20 before:h-px before:bg-linear-to-r before:from-transparent before:via-white/60 before:to-transparent before:content-[''] after:pointer-events-none after:absolute after:inset-0 after:z-0 after:bg-linear-to-br after:from-white/15 after:via-white/5 after:to-transparent after:content-['']",
+ "relative isolate flex h-full min-h-0 w-full flex-col overflow-hidden rounded-2xl border border-foreground/10 px-4 py-2 text-popover-foreground before:pointer-events-none before:absolute before:inset-x-5 before:top-0 before:z-20 before:h-px before:bg-linear-to-r before:from-transparent before:via-white/60 before:to-transparent before:content-[''] after:pointer-events-none after:absolute after:inset-0 after:z-0 after:bg-linear-to-br after:from-white/15 after:via-white/5 after:to-transparent after:content-['']",
+ showShadow ? "shadow-2xl shadow-black/20" : "shadow-none",
useBackdropEffect
? "bg-popover/70 backdrop-blur-2xl backdrop-saturate-150"
: "bg-popover/95",
].join(" ")}
>
- <div className="relative z-10 flex h-6 items-center gap-2">
+ <div className="relative z-10 flex h-6 shrink-0 items-center gap-2">
<Bot className="size-4 shrink-0 text-foreground" aria-hidden />
<h2 id={titleId} className="text-sm font-semibold tracking-[-0.015em] text-foreground">
Running bots
@@ -91,8 +93,8 @@ export function ProfileRunningBotsCard({ onOpenBotAudit, useBackdropEffect = tru
</span>
</div>
- <div className="relative z-10 mt-2 min-h-0 flex-1 border-t border-foreground/10 pt-2">
- <div className="h-full max-h-64 divide-y divide-border/40 overflow-y-auto pr-1 thin-scrollbar">
+ <div className="relative z-10 mt-2 flex min-h-0 flex-1 flex-col border-t border-foreground/10 pt-2">
+ <div className="min-h-0 max-h-64 flex-1 divide-y divide-border/40 overflow-y-auto overscroll-contain pr-1 thin-scrollbar">
{runningBots.map((bot) => (
<BotRow key={bot.id} bot={bot} onOpenBotAudit={onOpenBotAudit} />
))}
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.ts
index e3ae32771..763b26312 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
@@ -117,7 +117,7 @@ test.describe.serial("mobile server header direct hierarchy", () => {
const pathname = new URL(page.url()).pathname
await page.setViewportSize({ width: 640, height: 844 })
- await expect(page.getByRole("button", { name: "Back" })).toBeHidden()
+ await expect(page.getByRole("button", { name: "Back" })).toBeVisible()
await expect(page.getByTestId(tid.channelComposerShell)).toBeVisible()
expect(await page.evaluate(({ composerTestId }) => ({
banner: Reflect.get(window, "__headerHierarchyBanner") === document.querySelector('button[aria-label="Back"]')?.closest("header[role=banner]"),