Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix(web): polish bot log loading and empty states

Gus8d2e20e801b0
diff --git a/src/web/src/components/community/social/bot-audit-preview.module.css b/src/web/src/components/community/social/bot-audit-preview.module.css
index 9d862cb1e..59fcf4963 100644
--- a/src/web/src/components/community/social/bot-audit-preview.module.css
+++ b/src/web/src/components/community/social/bot-audit-preview.module.css
@@ -1 +1 @@
-.asciiOrbit { width: 54px; height: 21px; flex-shrink: 0; overflow: hidden; margin: 0; color: var(--note-ink, currentColor); font-size: 3px; font-weight: 700; line-height: 3px; letter-spacing: 0; white-space: pre; user-select: none; }
+.asciiOrbit { width: 54px; height: 21px; flex-shrink: 0; overflow: hidden; margin: 0; color: var(--note-ink, currentColor); font-size: 3px; font-weight: 900; -webkit-text-stroke: 0.15px currentColor; line-height: 3px; letter-spacing: 0; white-space: pre; user-select: none; }
diff --git a/src/web/src/components/community/social/bot-mark-sticker.dom.test.ts b/src/web/src/components/community/social/bot-mark-sticker.dom.test.ts
index 5f1610bd7..19f6c1d10 100644
--- a/src/web/src/components/community/social/bot-mark-sticker.dom.test.ts
+++ b/src/web/src/components/community/social/bot-mark-sticker.dom.test.ts
@@ -241,6 +241,28 @@ describe("BotMarkSticker", () => {
expect(renderer.container.textContent).toContain(state === "isLoading" ? "Loading thoughts" : "Thoughts unavailable")
})
+ it.each(["content", "empty", "error"] as const)("replaces the loading skeleton with %s", (state) => {
+ mocks.activity.isLoading = true
+ const { renderer, props } = render()
+ const loading = renderer.container.querySelector('[role="status"][aria-label="Loading thoughts"]')
+ expect(loading).not.toBeNull()
+ expect(loading?.querySelector('[aria-hidden="true"]')).not.toBeNull()
+ expect(loading?.querySelector("button, a")).toBeNull()
+ expect(renderer.container.textContent).not.toContain("No recent thoughts")
+
+ mocks.activity.isLoading = false
+ mocks.activity.isError = state === "error"
+ if (state === "content") mocks.activity.events = [{
+ id: "loaded-thought",
+ kind: "text",
+ payload: { text: "The report is ready", truncated: false, chars: 19 },
+ createdAt: "2026-09-04T00:00:00.000Z",
+ }]
+ renderer.rerender(React.createElement(BotMarkSticker, props))
+ expect(renderer.container.querySelector('[aria-label="Loading thoughts"]')).toBeNull()
+ expect(renderer.container.textContent).toContain(state === "content" ? "The report is ready" : state === "error" ? "Thoughts unavailable" : "No recent thoughts")
+ })
+
it("anchors initial rows at the tail and only follows live rows when already near it", () => {
const events = (start: number) => Array.from({ length: 10 }, (_, index) => ({
id: `event_${start + index}`,
diff --git a/src/web/src/components/community/social/bot-mark-sticker.module.css b/src/web/src/components/community/social/bot-mark-sticker.module.css
index f5beaba73..98ff8b660 100644
--- a/src/web/src/components/community/social/bot-mark-sticker.module.css
+++ b/src/web/src/components/community/social/bot-mark-sticker.module.css
@@ -83,3 +83,16 @@
.scrollbar { scrollbar-color: var(--note-rule) transparent; }
.scrollbar:hover { scrollbar-color: var(--note-muted) transparent; }
.notebook ::selection { background: color-mix(in srgb, var(--note-ink) 15%, var(--note-paper)); }
+
+.loading { padding: 16px 8px; }
+.loadingEntries { display: flex; flex-direction: column; gap: 24px; }
+.loadingEntry { display: flex; flex-direction: column; gap: 8px; }
+.loadingTime, .loadingLine { display: block; border-radius: 2px; background: var(--note-rule); }
+.loadingTime { width: 64px; height: 6px; margin-bottom: 4px; }
+.loadingLine { height: 8px; }
+.loadingLine:last-child { width: 64%; }
+.loadingEntry:first-child .loadingLine:nth-child(3) { width: 88%; }
+.loadingEntry:last-child .loadingLine:last-child { width: 46%; }
+@container notebook (max-height: 319px) {
+ .loadingEntry:first-child { display: none; }
+}
diff --git a/src/web/src/components/community/social/bot-mark-sticker.tsx b/src/web/src/components/community/social/bot-mark-sticker.tsx
index dca426fb0..b6229c074 100644
--- a/src/web/src/components/community/social/bot-mark-sticker.tsx
+++ b/src/web/src/components/community/social/bot-mark-sticker.tsx
@@ -148,8 +148,8 @@ export function BotMarkSticker({
nearTailRef.current = currentTarget.scrollHeight - (currentTarget.scrollTop + currentTarget.clientHeight) < 80
}}
className={`thin-scrollbar ${styles.scrollbar} min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain`}>
- <div ref={activityBottomAnchorRef} data-testid={tid.botAuditPreviewBottom} className="flex min-h-full flex-col justify-end">
- {activity.isLoading ? <StickerState label="Loading thoughts" /> : activity.isError ? <StickerState label="Thoughts unavailable" /> : visibleEvents.length === 0 ? <StickerState label="No recent thoughts" /> : visibleEvents.map((event) => {
+ <div ref={activityBottomAnchorRef} data-testid={tid.botAuditPreviewBottom} className={`flex min-h-full flex-col ${!activity.isLoading && (activity.isError || visibleEvents.length === 0) ? "justify-center" : "justify-end"}`}>
+ {activity.isLoading ? <ThoughtsLoading /> : activity.isError ? <StickerState label="Thoughts unavailable" /> : visibleEvents.length === 0 ? <StickerState label="No recent thoughts" /> : visibleEvents.map((event) => {
const parsed = AuditLogTextPayloadSchema.safeParse(event.payload)
return <div key={event.id} data-testid={tid.botAuditPreviewRow(event.id)} className={styles.entry}>
<button type="button" onClick={onOpenActivity} title="Open full audit log"
@@ -258,6 +258,24 @@ export function BotMarkSticker({
)
}
+function ThoughtsLoading() {
+ return (
+ <div role="status" aria-label="Loading thoughts" className={styles.loading}>
+ <span className="sr-only">Loading thoughts</span>
+ <div aria-hidden="true" className={styles.loadingEntries}>
+ {[0, 1].map((entry) => (
+ <div key={entry} className={styles.loadingEntry}>
+ <span className={styles.loadingTime} />
+ <span className={styles.loadingLine} />
+ <span className={styles.loadingLine} />
+ <span className={styles.loadingLine} />
+ </div>
+ ))}
+ </div>
+ </div>
+ )
+}
+
function StickerState({ label }: { label: string }) {
return (
<div className="flex h-full items-center justify-center px-4 text-xs text-(--note-muted)">