Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): stabilize community waiting transitions (#793)

Gustavo Ye14931f56ce83
diff --git a/src/web/src/app/c/channels/[serverId]/page.dom.test.ts b/src/web/src/app/c/channels/[serverId]/page.dom.test.ts
index 9117a41c6..8bbbda29a 100644
--- a/src/web/src/app/c/channels/[serverId]/page.dom.test.ts
+++ b/src/web/src/app/c/channels/[serverId]/page.dom.test.ts
@@ -13,6 +13,10 @@ const mocks = vi.hoisted(() => ({
} },
}))
+vi.mock("@/components/brand/alook-loading/AlookLoading", () => ({
+ AlookLoading: () => null,
+}))
+
vi.mock("next/navigation", () => ({
useParams: () => ({ serverId: "server_1" }),
useRouter: () => ({ replace: mocks.replace }),
diff --git a/src/web/src/components/community/channels/channel-loading-frame.test.ts b/src/web/src/components/community/channels/channel-loading-frame.test.ts
index dfb4ee9c7..281360e69 100644
--- a/src/web/src/components/community/channels/channel-loading-frame.test.ts
+++ b/src/web/src/components/community/channels/channel-loading-frame.test.ts
@@ -9,7 +9,8 @@ describe("ChannelLoadingFrame", () => {
const markup = renderToStaticMarkup(createElement(Component))
expect(markup.match(/data-community-unresolved-main=""/g)).toHaveLength(1)
- expect(markup.match(/data-slot="skeleton"/g)).toHaveLength(1)
+ expect(markup).not.toContain('data-slot="skeleton"')
+ expect(markup).toContain('aria-label="Connecting…"')
expect(markup).toContain('aria-busy="true"')
expect(markup).toContain('aria-label="Loading conversation"')
expect(markup).not.toContain("data-community-mobile-transition")
diff --git a/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts b/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
index 8d0912122..83974cc8f 100644
--- a/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
+++ b/src/web/src/components/community/channels/channel-route.text-scroll-target.dom.test.ts
@@ -76,6 +76,10 @@ const {
},
}))
+vi.mock("@/components/brand/alook-loading/AlookLoading", () => ({
+ AlookLoading: () => null,
+}))
+
vi.mock("next/navigation", () => ({
useRouter: () => mockRouter,
usePathname: () => "/c/channels/server_1/channel_1",
diff --git a/src/web/src/components/community/channels/conversation-resolution-pending-frame.test.ts b/src/web/src/components/community/channels/conversation-resolution-pending-frame.test.ts
index f7f731f17..d9398cf7d 100644
--- a/src/web/src/components/community/channels/conversation-resolution-pending-frame.test.ts
+++ b/src/web/src/components/community/channels/conversation-resolution-pending-frame.test.ts
@@ -8,7 +8,8 @@ describe("ConversationResolutionPendingFrame", () => {
const markup = renderToStaticMarkup(createElement(ConversationResolutionPendingFrame))
expect(markup.match(/data-community-unresolved-main=""/g)).toHaveLength(1)
- expect(markup.match(/data-slot="skeleton"/g)).toHaveLength(1)
+ expect(markup).not.toContain('data-slot="skeleton"')
+ expect(markup).toContain('aria-label="Connecting…"')
})
it("stays inert and exposes no speculative conversation content", () => {
diff --git a/src/web/src/components/community/messages/message-list-view.dom.test.ts b/src/web/src/components/community/messages/message-list-view.dom.test.ts
index a7b240fd2..947b843d1 100644
--- a/src/web/src/components/community/messages/message-list-view.dom.test.ts
+++ b/src/web/src/components/community/messages/message-list-view.dom.test.ts
@@ -151,6 +151,10 @@ describe("renderMessageListView", () => {
expect(content).toHaveClass("pointer-events-none", "opacity-0")
expect(content).not.toHaveClass("transition-opacity", "duration-300")
expect(mockedRail).not.toHaveBeenCalled()
+ const skeleton = renderer.container.querySelector("[data-message-positioning-skeleton]")!
+ expect(skeleton).toHaveClass("absolute", "inset-0", "pointer-events-none", "opacity-100")
+ expect(skeleton.querySelector('[data-slot="skeleton"]')).toBeInTheDocument()
+ expect(skeleton.parentElement).toBe(content.parentElement?.parentElement)
})
it("crossfades content against the pointer-transparent aurora without changing geometry", () => {
@@ -168,6 +172,7 @@ describe("renderMessageListView", () => {
))
const content = () => renderer.container.querySelector<HTMLElement>("[data-message-list-content]")!
expect(content()).toHaveClass("opacity-0")
+ expect(renderer.container.querySelector("[data-message-positioning-skeleton]")).toHaveClass("opacity-100")
expect(content()).not.toHaveClass("transition-opacity", "duration-300")
expect(renderer.getByTestId("community-initial-position-aurora"))
.toHaveAttribute("data-phase", "aurora")
@@ -183,6 +188,7 @@ describe("renderMessageListView", () => {
() => React.createElement("virtual-rows"),
))
expect(content()).toHaveClass("opacity-100", "transition-opacity", "duration-300", "ease-linear")
+ expect(renderer.container.querySelector("[data-message-positioning-skeleton]")).toHaveClass("opacity-0", "transition-opacity")
const boundary = renderer.container.querySelector("[data-message-scroller-boundary]")!
expect(boundary).toHaveClass("isolate")
expect(renderer.getByTestId("community-message-scroller")).toHaveClass("relative", "z-10")
@@ -200,6 +206,7 @@ describe("renderMessageListView", () => {
))
expect(content()).toHaveClass("opacity-100")
expect(content()).not.toHaveClass("transition-opacity", "duration-300")
+ expect(renderer.container.querySelector("[data-message-positioning-skeleton]")).not.toBeInTheDocument()
})
it("routes typing through the rail without adding a dynamic flex sibling", () => {
diff --git a/src/web/src/components/community/messages/message-list-view.tsx b/src/web/src/components/community/messages/message-list-view.tsx
index 0d795ed83..040d1c24d 100644
--- a/src/web/src/components/community/messages/message-list-view.tsx
+++ b/src/web/src/components/community/messages/message-list-view.tsx
@@ -94,6 +94,23 @@ export function renderMessageListView(
)}
</div>
</div>
+ {!controller.initialPosition.showSkeleton && (
+ !controller.initialPosition.contentVisible || controller.initialPosition.phase === "revealing"
+ ) && (
+ <div
+ aria-hidden="true"
+ data-message-positioning-skeleton
+ className={`pointer-events-none absolute inset-0 z-20 flex flex-col overflow-hidden bg-(--app-bg) ${
+ controller.initialPosition.contentVisible
+ ? "opacity-0 transition-opacity duration-300 ease-linear motion-reduce:transition-opacity"
+ : "opacity-100"
+ }`}
+ >
+ <div className="flex min-h-full flex-col justify-end px-4 pb-14 pt-8 sm:pb-18">
+ <MessageListSkeletonContent variant={props.variant} />
+ </div>
+ </div>
+ )}
<InitialPositionAurora phase={controller.initialPosition.phase} />
</div>
</div>
diff --git a/src/web/src/components/community/shell/community-connecting-indicator.tsx b/src/web/src/components/community/shell/community-connecting-indicator.tsx
new file mode 100644
index 000000000..efcd0f579
--- /dev/null
+++ b/src/web/src/components/community/shell/community-connecting-indicator.tsx
@@ -0,0 +1,39 @@
+"use client"
+
+import { AlookLoading } from "@/components/brand/alook-loading/AlookLoading"
+
+const CONNECTING_LABEL = "Connecting…"
+
+export function CommunityConnectingIndicator({ titleId }: { titleId?: string }) {
+ return (
+ <div
+ role="status"
+ aria-live="polite"
+ aria-atomic="true"
+ data-slot="text-loader"
+ data-variant="default"
+ className="community-ws-connecting-loader"
+ >
+ {/* Adapted from OpensourceUI's TextLoader. See ../../home/opensourceui-mockups.LICENSE.txt. */}
+ <div aria-hidden="true" data-connecting-motion="" className="flex h-36 w-44 items-center justify-center sm:h-40 sm:w-48">
+ <AlookLoading size={192} className="scale-90 sm:scale-100" />
+ </div>
+ <h2
+ id={titleId}
+ aria-label={CONNECTING_LABEL}
+ className="community-ws-connecting-text justify-center font-heading text-base font-medium"
+ >
+ {CONNECTING_LABEL.split("").map((letter, index) => (
+ <span
+ key={`${letter}-${index}`}
+ aria-hidden="true"
+ className="community-ws-connecting-letter"
+ style={{ animationDelay: `${index * 0.09}s` }}
+ >
+ {letter}
+ </span>
+ ))}
+ </h2>
+ </div>
+ )
+}
diff --git a/src/web/src/components/community/shell/community-pending-frame.dom.test.ts b/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
index 2dd85a636..07786e2cf 100644
--- a/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
+++ b/src/web/src/components/community/shell/community-pending-frame.dom.test.ts
@@ -2,6 +2,10 @@ import { createElement } from "react"
import { describe, expect, it, vi } from "vitest"
import { render, screen } from "@/test/react-dom-harness"
+vi.mock("@/components/brand/alook-loading/AlookLoading", () => ({
+ AlookLoading: () => null,
+}))
+
vi.mock("@/components/community/machines/machine-list", () => ({
MachineListSkeleton: ({ reserveBackSlot }: { reserveBackSlot?: boolean }) => createElement("div", {
"data-testid": "machine-skeleton",
diff --git a/src/web/src/components/community/shell/community-ws-reconnect-overlay.tsx b/src/web/src/components/community/shell/community-ws-reconnect-overlay.tsx
index 364df01ea..95dd80b47 100644
--- a/src/web/src/components/community/shell/community-ws-reconnect-overlay.tsx
+++ b/src/web/src/components/community/shell/community-ws-reconnect-overlay.tsx
@@ -1,15 +1,13 @@
"use client"
import { useEffect, useRef, type ReactNode } from "react"
-import { AlookLoading } from "@/components/brand/alook-loading/AlookLoading"
+import { CommunityConnectingIndicator } from "./community-connecting-indicator"
import { AppEdgeFade } from "@/components/ui/app-edge-fade"
import { WifiOff } from "lucide-react"
import { Button } from "@/components/ui/button"
import { tid } from "@/lib/community/testids"
import { useCommunityWsStore } from "@/stores/community/ws"
-const CONNECTING_LABEL = "Connecting…"
-
export function CommunityWsReconnectBoundary({ children }: { children: ReactNode }) {
const connectionStatus = useCommunityWsStore((state) => state.connectionStatus)
const reconnectNow = useCommunityWsStore((state) => state.reconnectNow)
@@ -78,35 +76,7 @@ export function CommunityWsReconnectBoundary({ children }: { children: ReactNode
</Button>
</>
) : (
- <div
- role="status"
- aria-live="polite"
- aria-atomic="true"
- data-slot="text-loader"
- data-variant="default"
- className="community-ws-connecting-loader"
- >
- {/* Adapted from OpensourceUI's TextLoader. See ../../home/opensourceui-mockups.LICENSE.txt. */}
- <div aria-hidden="true" data-connecting-motion="" className="flex h-36 w-44 items-center justify-center sm:h-40 sm:w-48">
- <AlookLoading size={192} className="scale-90 sm:scale-100" />
- </div>
- <h2
- id="community-ws-reconnect-title"
- aria-label={CONNECTING_LABEL}
- className="community-ws-connecting-text justify-center font-heading text-base font-medium"
- >
- {CONNECTING_LABEL.split("").map((letter, index) => (
- <span
- key={`${letter}-${index}`}
- aria-hidden="true"
- className="community-ws-connecting-letter"
- style={{ animationDelay: `${index * 0.09}s` }}
- >
- {letter}
- </span>
- ))}
- </h2>
- </div>
+ <CommunityConnectingIndicator titleId="community-ws-reconnect-title" />
)}
</div>
</div>
diff --git a/src/web/src/components/community/shell/unresolved-main-skeleton.test.ts b/src/web/src/components/community/shell/unresolved-main-skeleton.test.ts
index 08e1c817d..736daa3e1 100644
--- a/src/web/src/components/community/shell/unresolved-main-skeleton.test.ts
+++ b/src/web/src/components/community/shell/unresolved-main-skeleton.test.ts
@@ -4,16 +4,19 @@ import { describe, expect, it } from "vitest"
import { UnresolvedMainSkeleton } from "./unresolved-main-skeleton"
describe("UnresolvedMainSkeleton", () => {
- it("keeps one muted pulse over an opaque app surface with inert edge fades", () => {
+ it("shows the shared Connecting indicator on a static app surface with inert edge fades", () => {
const markup = renderToStaticMarkup(createElement(UnresolvedMainSkeleton))
- expect(markup.match(/data-slot="skeleton"/g)).toHaveLength(1)
+ expect(markup).not.toContain('data-slot="skeleton"')
+ expect(markup).toContain('role="status"')
+ expect(markup).toContain('aria-label="Connecting…"')
+ expect(markup).not.toContain('role="dialog"')
+ expect(markup).not.toContain('aria-modal')
+ expect(markup).not.toContain('community-ws-reconnect-title')
expect(markup).toContain('data-community-unresolved-main=""')
expect(markup).toContain('aria-hidden="true"')
expect(markup).toContain("h-full w-full flex-1 overflow-hidden bg-(--app-bg)")
- expect(markup).toContain("absolute inset-0 rounded-none")
- expect(markup).toContain("animate-pulse")
- expect(markup).toContain("motion-reduce:animate-none")
+ expect(markup).not.toContain("animate-pulse")
expect(markup.match(/data-slot="app-edge-fade"/g)).toHaveLength(1)
expect(markup.match(/h-\(--app-edge-fade-size\)/g)).toHaveLength(2)
expect(markup).toContain("from-(--app-bg) to-transparent")
diff --git a/src/web/src/components/community/shell/unresolved-main-skeleton.tsx b/src/web/src/components/community/shell/unresolved-main-skeleton.tsx
index f831b36c0..fb19decd2 100644
--- a/src/web/src/components/community/shell/unresolved-main-skeleton.tsx
+++ b/src/web/src/components/community/shell/unresolved-main-skeleton.tsx
@@ -1,14 +1,15 @@
-import { Skeleton } from "@/components/ui/skeleton"
+import { CommunityConnectingIndicator } from "./community-connecting-indicator"
import { AppEdgeFade } from "@/components/ui/app-edge-fade"
export function UnresolvedMainSkeleton() {
return (
<div
- aria-hidden
data-community-unresolved-main=""
- className="relative min-h-0 h-full w-full flex-1 overflow-hidden bg-(--app-bg)"
+ className="relative grid place-items-center min-h-0 h-full w-full flex-1 overflow-hidden bg-(--app-bg)"
>
- <Skeleton className="absolute inset-0 rounded-none" />
+ <div className="relative z-20 flex w-full max-w-xs flex-col items-center text-center text-foreground">
+ <CommunityConnectingIndicator />
+ </div>
<AppEdgeFade />
</div>
)
diff --git a/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts b/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts
index 657e9e2cf..4cfa44d6b 100644
--- a/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts
+++ b/src/web/src/test/e2e-ui/25-community-ws-reconnect-overlay.spec.ts
@@ -212,20 +212,16 @@ test("app edge fade keeps the unresolved main surface native-aligned across them
const edge = await appEdgeEvidence(unresolved)
expectAppEdgeEvidence(edge)
expect(edge.surfaceBackground).toBe(edge.appBackground)
- const pulse = await unresolved.locator('[data-slot="skeleton"]').evaluate((element) => {
- const style = getComputedStyle(element)
- return {
- animationDuration: style.animationDuration,
- animationName: style.animationName,
- backgroundColor: style.backgroundColor,
- }
- })
- expect(pulse.animationName === "none").toBe(entry.reducedMotion === "reduce")
- if (entry.reducedMotion === "no-preference") {
- expect(pulse.animationDuration).toBe("2s")
- }
- expect(pulse.backgroundColor).not.toBe(edge.appBackground)
- await attachEvidence(testInfo, alice.page, entry.name, { edge, pulse, entry })
+ await expect(unresolved.getByRole("heading", { name: "Connecting…" })).toBeVisible()
+ await expect(unresolved.locator('[data-slot="skeleton"]')).toHaveCount(0)
+ await expect(unresolved.getByRole("dialog")).toHaveCount(0)
+ const waiting = await unresolved.evaluate((element) => ({
+ animationName: getComputedStyle(element).animationName,
+ textAnimation: getComputedStyle(element.querySelector(".community-ws-connecting-letter")!).animationName,
+ }))
+ expect(waiting.animationName).toBe("none")
+ expect(waiting.textAnimation === "none").toBe(entry.reducedMotion === "reduce")
+ await attachEvidence(testInfo, alice.page, entry.name, { edge, waiting, entry })
}
} finally {
releaseServerDetail()