Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): stabilize landing workspace loading and unread geometry

Guse3f092fb2e8b
diff --git a/DESIGN.md b/DESIGN.md
index ec214bc25..2c44da269 100644
--- a/DESIGN.md
+++ b/DESIGN.md
@@ -268,7 +268,7 @@ Words are part of the interface. They should sound like the brand: **warm, sharp
## Interactive landing workspace
- Keep the interactive second screen separate from the existing product story. Use native community views with local data; preview navigation and actions must not mutate a real account.
-- Reserve the workspace frame before loading. Mount its isolated document only after the homepage load event and an idle callback; show the existing centered Alook loading animation until that document reports readiness.
+- Reserve the workspace frame before loading. Mount its isolated document immediately after the homepage load event; show a responsive workspace skeleton until that document reports readiness. Readiness must not depend on animation callbacks in the hidden iframe.
- Compact preview typography must preserve fixed-pixel rail, avatar, and Inbox geometry. Grouped messages and reply previews align with the first message's avatar column.
- Bot logs use local fixed Thoughts and Marks. Preview Thoughts are static. Scroll-to-tail affects only the notebook scroller, never the surrounding landing page.
- Production loading has no QA hold switch or test-only URL controls.
diff --git a/src/web/src/components/community/channels/channel-sidebar.navigation.dom.test.tsx b/src/web/src/components/community/channels/channel-sidebar.navigation.dom.test.tsx
index b427ccee1..9f9c3a072 100644
--- a/src/web/src/components/community/channels/channel-sidebar.navigation.dom.test.tsx
+++ b/src/web/src/components/community/channels/channel-sidebar.navigation.dom.test.tsx
@@ -6,7 +6,9 @@ import { useChannelTree } from "./use-channel-tree"
vi.mock("next/link", async () => ({ default: (await import("@/test/community-link-mock")).CommunityLinkMock }))
-function Sidebar({ onPick, isAdmin = true, grouped = false, onReorder }: {
+function Sidebar({ onPick, isAdmin = true, grouped = false, onReorder, unread = false, muted = false }: {
+ unread?: boolean
+ muted?: boolean
onPick: (id: string) => void
isAdmin?: boolean
grouped?: boolean
@@ -14,13 +16,25 @@ function Sidebar({ onPick, isAdmin = true, grouped = false, onReorder }: {
}) {
const tree = useChannelTree([{ id: grouped ? "group" : "none", name: grouped ? "Group" : "", channels: [
{ id: "one", name: "One", active: false, unread: false, type: "text" },
- { id: "two", name: "Two", active: false, unread: false, type: "forum" },
+ { id: "two", name: unread ? "design-feedback-with-a-long-channel-name" : "Two", active: false, unread, muted, type: "forum" },
] }])
return <ChannelSidebar tree={tree} serverId="server" serverName="Server" activeChannel="one"
setActiveChannel={onPick} onReorderChannels={onReorder} noHeader isAdmin={isAdmin} />
}
describe("real sortable channel navigation surface", () => {
+ it("reserves a non-shrinking dot beside a long unread channel name", () => {
+ const view = render(<Sidebar onPick={vi.fn()} unread />)
+ const row = view.getByTestId(tid.channelRow("two"))
+ expect(row.querySelector(".truncate")).toHaveTextContent("design-feedback-with-a-long-channel-name")
+ expect(row.querySelector(".rounded-full.bg-primary")).toHaveClass("size-2", "shrink-0")
+ })
+
+ it("does not show an unread dot for a muted channel", () => {
+ const view = render(<Sidebar onPick={vi.fn()} unread muted />)
+ expect(view.getByTestId(tid.channelRow("two")).querySelector(".rounded-full.bg-primary")).toBeNull()
+ })
+
it("keeps href and sortable attributes on the anchor and Enter activates once", async () => {
const onPick = vi.fn()
const view = render(<Sidebar onPick={onPick} />)
diff --git a/src/web/src/components/community/channels/sortable-channel.tsx b/src/web/src/components/community/channels/sortable-channel.tsx
index e7803cc60..c30668f8b 100644
--- a/src/web/src/components/community/channels/sortable-channel.tsx
+++ b/src/web/src/components/community/channels/sortable-channel.tsx
@@ -88,7 +88,7 @@ export function SortableChannel({ ch, href, active, onClick, onEdit, onDelete, o
{ch.muted ? (
<BellOff className="ml-auto size-4 shrink-0 opacity-70" />
) : unread.showDot ? (
- <span className="ml-auto size-2 rounded-full bg-primary" />
+ <span className="ml-auto size-2 shrink-0 rounded-full bg-primary" />
) : null}
</>
)
diff --git a/src/web/src/components/home/landing-interactive-demo.dom.test.tsx b/src/web/src/components/home/landing-interactive-demo.dom.test.tsx
index 32a154d1a..84ff159c8 100644
--- a/src/web/src/components/home/landing-interactive-demo.dom.test.tsx
+++ b/src/web/src/components/home/landing-interactive-demo.dom.test.tsx
@@ -2,23 +2,16 @@ import { act, render, screen } from "@/test/react-dom-harness"
import { afterEach, describe, expect, it, vi } from "vitest"
import { LandingInteractiveDemo } from "./landing-interactive-demo"
-vi.mock("@/components/brand/alook-loading/AlookLoading", () => ({ AlookLoading: ({ label }: { label: string }) => <span role="status">{label}</span> }))
afterEach(() => { vi.restoreAllMocks(); vi.unstubAllGlobals(); vi.useRealTimers() })
describe("background workspace loading", () => {
- it("waits for the homepage load and idle time, then keeps the loader until its own frame is ready", () => {
+ it("waits for the homepage load, then keeps the loader until its own frame is ready", () => {
vi.spyOn(document, "readyState", "get").mockReturnValue("loading")
- let idle!: IdleRequestCallback
- const request = vi.fn((callback: IdleRequestCallback) => { idle = callback; return 7 })
- vi.stubGlobal("requestIdleCallback", request)
- vi.stubGlobal("cancelIdleCallback", vi.fn())
render(<LandingInteractiveDemo />)
expect(screen.queryByTitle("Alook workspace")).toBeNull()
- expect(request).not.toHaveBeenCalled()
+ expect(screen.getByRole("status")).toHaveAttribute("aria-label", "Loading Alook workspace")
+ expect(document.querySelectorAll('[data-slot="skeleton"]').length).toBeGreaterThan(10)
act(() => window.dispatchEvent(new Event("load")))
- expect(request).toHaveBeenCalledOnce()
- expect(screen.queryByTitle("Alook workspace")).toBeNull()
- act(() => idle({ didTimeout: false, timeRemaining: () => 10 }))
const frame = screen.getByTitle("Alook workspace") as HTMLIFrameElement
expect(frame).toHaveAttribute("src", "/demo")
expect(screen.getByRole("status")).toBeVisible()
@@ -31,23 +24,20 @@ describe("background workspace loading", () => {
expect(frame).toHaveAttribute("aria-hidden", "false")
})
- it("cancels deferred work when unmounted", () => {
- vi.spyOn(document, "readyState", "get").mockReturnValue("complete")
- vi.stubGlobal("requestIdleCallback", vi.fn(() => 9))
- const cancel = vi.fn()
- vi.stubGlobal("cancelIdleCallback", cancel)
+ it("removes the pending load listener when unmounted", () => {
+ vi.spyOn(document, "readyState", "get").mockReturnValue("loading")
+ const remove = vi.spyOn(window, "removeEventListener")
const view = render(<LandingInteractiveDemo />)
view.unmount()
- expect(cancel).toHaveBeenCalledWith(9)
+ expect(remove).toHaveBeenCalledWith("load", expect.any(Function))
})
- it("yields after load when idle callbacks are unavailable", () => {
- vi.useFakeTimers()
+ it("starts immediately when the homepage has already loaded", () => {
vi.spyOn(document, "readyState", "get").mockReturnValue("complete")
- vi.stubGlobal("requestIdleCallback", undefined)
+ const idle = vi.fn()
+ vi.stubGlobal("requestIdleCallback", idle)
render(<LandingInteractiveDemo />)
- expect(screen.queryByTitle("Alook workspace")).toBeNull()
- act(() => vi.advanceTimersByTime(200))
expect(screen.getByTitle("Alook workspace")).toHaveAttribute("src", "/demo")
+ expect(idle).not.toHaveBeenCalled()
})
})
diff --git a/src/web/src/components/home/landing-interactive-demo.tsx b/src/web/src/components/home/landing-interactive-demo.tsx
index e67f7472e..43bbf0e12 100644
--- a/src/web/src/components/home/landing-interactive-demo.tsx
+++ b/src/web/src/components/home/landing-interactive-demo.tsx
@@ -1,7 +1,7 @@
"use client"
import { useEffect, useRef, useState } from "react"
-import { AlookLoading } from "@/components/brand/alook-loading/AlookLoading"
+import { LandingWorkspaceSkeleton } from "./landing-workspace-skeleton"
import styles from "./landing-interactive-shell.module.css"
export function LandingInteractiveDemo() {
@@ -9,20 +9,10 @@ export function LandingInteractiveDemo() {
const [ready, setReady] = useState(false)
const frame = useRef<HTMLIFrameElement>(null)
useEffect(() => {
- let idle: number | undefined
- let timer: number | undefined
- const start = () => { idle = undefined; timer = undefined; setStarted(true) }
- const schedule = () => {
- if (typeof window.requestIdleCallback === "function") idle = window.requestIdleCallback(start, { timeout: 2000 })
- else timer = window.setTimeout(start, 200)
- }
- if (document.readyState === "complete") schedule()
- else window.addEventListener("load", schedule, { once: true })
- return () => {
- window.removeEventListener("load", schedule)
- if (idle !== undefined) window.cancelIdleCallback(idle)
- if (timer !== undefined) window.clearTimeout(timer)
- }
+ const start = () => setStarted(true)
+ if (document.readyState === "complete") start()
+ else window.addEventListener("load", start, { once: true })
+ return () => window.removeEventListener("load", start)
}, [])
useEffect(() => {
const receive = (event: MessageEvent) => {
@@ -33,7 +23,7 @@ export function LandingInteractiveDemo() {
}, [])
return <section id="workspace" className={styles.section} aria-label="Explore Alook" data-testid="landing-interactive-section">
<div className={styles.frame} aria-busy={!ready}>
- {!ready && <div className={styles.loading}><AlookLoading size={96} label="Loading Alook workspace" paused={!started} /></div>}
+ {!ready && <LandingWorkspaceSkeleton />}
{started && <iframe ref={frame} src="/demo" title="Alook workspace" className={styles.workspace} aria-hidden={!ready} tabIndex={ready ? undefined : -1} style={{ opacity: ready ? 1 : 0 }} />}
</div>
</section>
diff --git a/src/web/src/components/home/landing-interactive-shell.dom.test.tsx b/src/web/src/components/home/landing-interactive-shell.dom.test.tsx
index a1faadb24..38343ad05 100644
--- a/src/web/src/components/home/landing-interactive-shell.dom.test.tsx
+++ b/src/web/src/components/home/landing-interactive-shell.dom.test.tsx
@@ -13,9 +13,15 @@ vi.mock("@/components/community/messages/composer", () => ({ Composer: ({ onAcce
vi.mock("@/components/community/messages/message-list", () => ({ MessageList: ({ messages, unreadCount, onJumpToPresent, typingUsers, onScrollRoot, newDividerBefore }: { newDividerBefore?: string; onScrollRoot?: (el: HTMLDivElement | null) => void; typingUsers?: string[]; messages: { id: string; content: string }[]; unreadCount: number; onJumpToPresent: () => void }) => <div ref={onScrollRoot} data-testid="mock-message-scroll"><span data-testid="new-divider">{newDividerBefore}</span><span data-testid="typing-names">{typingUsers?.join(", ")}</span>{messages.map((message) => <p key={message.id}>{message.content}</p>)}{unreadCount > 0 && <button onClick={onJumpToPresent}>Catch up {unreadCount}</button>}</div> }))
beforeEach(() => { vi.stubGlobal("ResizeObserver", class { observe() {} disconnect() {} unobserve() {} }) })
-afterEach(() => vi.unstubAllGlobals())
+afterEach(() => { vi.unstubAllGlobals(); vi.restoreAllMocks() })
describe("interactive landing workspace", () => {
+ it("announces readiness even when the hidden frame gets no animation callbacks", () => {
+ vi.stubGlobal("requestAnimationFrame", vi.fn(() => 1))
+ const post = vi.spyOn(window.parent, "postMessage").mockImplementation(() => {})
+ render(<LandingInteractiveShell />)
+ expect(post).toHaveBeenCalledWith({ type: "alook-demo-ready" }, window.location.origin)
+ })
it("has three populated spaces and people sharing agents with different owners", () => {
expect(DEMO_SERVERS).toHaveLength(3)
for (const server of DEMO_SERVERS) {
diff --git a/src/web/src/components/home/landing-interactive-shell.module.css b/src/web/src/components/home/landing-interactive-shell.module.css
index 8ef0d8232..c16696958 100644
--- a/src/web/src/components/home/landing-interactive-shell.module.css
+++ b/src/web/src/components/home/landing-interactive-shell.module.css
@@ -27,4 +27,31 @@
:global(html):has(.previewRoot) :global([data-testid="community-user-bar"] button[aria-label="User settings"] > svg) { width: 16px; height: 16px; }
.workspace { display: block; width: 100%; height: 100%; border: 0; }
-.loading { position: absolute; inset: 0; display: grid; place-items: center; }
+
+.workspaceSkeleton { position: absolute; inset: 0; container-type: inline-size; background: var(--background); }
+.skeletonLayout { display: flex; width: 100%; height: 100%; font-size: 14px; }
+.skeletonRail { display: flex; flex-direction: column; align-items: center; gap: 16px; flex: 0 0 56px; padding-block: 16px; background: var(--app-bg); }
+.skeletonSidebar { display: flex; flex-direction: column; flex: 0 0 240px; min-width: 0; background: var(--sidebar); border-right: 1px solid var(--border); }
+.skeletonHeader { display: flex; align-items: center; gap: 8px; flex: 0 0 48px; padding-inline: 16px; border-bottom: 1px solid var(--border); }
+.skeletonChannels { padding: 24px 16px; }
+.skeletonChannel { display: flex; align-items: center; gap: 8px; height: 36px; }
+.skeletonUser { position: absolute; bottom: 0; left: 0; width: 296px; padding: 0 8px 12px; }
+.skeletonUserInner { display: flex; align-items: center; gap: 8px; height: 48px; padding-inline: 8px; border: 1px solid var(--border); border-radius: var(--radius-xl); background: var(--muted); }
+.skeletonUserAction { width: 28px; height: 28px; flex-shrink: 0; background: color-mix(in oklch, var(--background) 60%, transparent); }
+.skeletonChat { display: flex; flex: 1; flex-direction: column; min-width: 0; }
+.skeletonMessages { display: flex; flex: 1; flex-direction: column; gap: 32px; overflow: hidden; padding: 32px 24px; }
+.skeletonMessage { display: flex; gap: 16px; }
+.skeletonMessageText { flex: 1; min-width: 0; }
+.skeletonComposer { padding: 0 16px 12px; }
+@container (max-width: 639px) {
+ .skeletonSidebar { flex: 1; border-right: 0; }
+ .skeletonChat { display: none; }
+ .skeletonUser { width: 100%; padding-inline: 12px; }
+ .skeletonUserAction { width: 44px; height: 44px; }
+}
+
+:global(html):has(.previewRoot) :global(.chat-input-line-height),
+:global(html):has(.previewRoot) :global(.chat-composer .tiptap),
+:global(html):has(.previewRoot) :global(.chat-composer .tiptap p),
+:global(html):has(.previewRoot) :global(.chat-composer .tiptap li),
+:global(html):has(.previewRoot) :global(.chat-placeholder-overlay) { line-height: 1.5rem; }
diff --git a/src/web/src/components/home/landing-interactive-shell.tsx b/src/web/src/components/home/landing-interactive-shell.tsx
index 331334f05..1740ee44c 100644
--- a/src/web/src/components/home/landing-interactive-shell.tsx
+++ b/src/web/src/components/home/landing-interactive-shell.tsx
@@ -36,11 +36,7 @@ import styles from "./landing-interactive-shell.module.css"
export default function LandingInteractiveShell() {
useEffect(() => {
- let secondFrame = 0
- const firstFrame = requestAnimationFrame(() => {
- secondFrame = requestAnimationFrame(() => window.parent.postMessage({ type: "alook-demo-ready" }, window.location.origin))
- })
- return () => { cancelAnimationFrame(firstFrame); cancelAnimationFrame(secondFrame) }
+ window.parent.postMessage({ type: "alook-demo-ready" }, window.location.origin)
}, [])
const [queryClient] = useState(() => new QueryClient({ defaultOptions: { queries: { enabled: false, retry: false, staleTime: Infinity } } }))
const [registry] = useState(() => createCommunityDbRegistry(queryClient, null))
diff --git a/src/web/src/components/home/landing-workspace-skeleton.tsx b/src/web/src/components/home/landing-workspace-skeleton.tsx
new file mode 100644
index 000000000..ce90db8ec
--- /dev/null
+++ b/src/web/src/components/home/landing-workspace-skeleton.tsx
@@ -0,0 +1,31 @@
+import { Skeleton } from "@/components/ui/skeleton"
+import styles from "./landing-interactive-shell.module.css"
+
+export function LandingWorkspaceSkeleton() {
+ return <div className={styles.workspaceSkeleton} role="status" aria-label="Loading Alook workspace">
+ <div className={styles.skeletonLayout} aria-hidden="true">
+ <div className={styles.skeletonRail}>
+ {[0, 1, 2].map((i) => <Skeleton key={i} className="size-9 rounded-xl" />)}
+ </div>
+ <div className={styles.skeletonSidebar}>
+ <div className={styles.skeletonHeader}><Skeleton className="h-4 w-28" /></div>
+ <div className={styles.skeletonChannels}>
+ <Skeleton className="mb-4 h-3 w-16" />
+ {[70, 88, 62, 76].map((width) => <div className={styles.skeletonChannel} key={width}><Skeleton className="size-4" /><Skeleton style={{width: `${width}%`}} className="h-3" /></div>)}
+ </div>
+ </div>
+ <div className={styles.skeletonUser}><div className={styles.skeletonUserInner}>
+ <Skeleton className="size-7 shrink-0 rounded-full bg-background/60" />
+ <Skeleton className="h-3 min-w-0 flex-1 bg-background/60" />
+ <Skeleton className={styles.skeletonUserAction} /><Skeleton className={styles.skeletonUserAction} />
+ </div></div>
+ <div className={styles.skeletonChat}>
+ <div className={styles.skeletonHeader}><Skeleton className="size-5" /><Skeleton className="h-4 w-24" /></div>
+ <div className={styles.skeletonMessages}>
+ {[78, 62, 86].map((width) => <div className={styles.skeletonMessage} key={width}><Skeleton className="size-8 shrink-0 rounded-full" /><div className={styles.skeletonMessageText}><Skeleton className="mb-3 h-3 w-24" /><Skeleton className="mb-2 h-3" style={{width:`${width}%`}} /><Skeleton className="h-3" style={{width:`${width-22}%`}} /></div></div>)}
+ </div>
+ <div className={styles.skeletonComposer}><Skeleton className="h-12 w-full rounded-xl" /></div>
+ </div>
+ </div>
+ </div>
+}