From 76ae65dcd19d1080b60310cc778199c973b0dbb1 Mon Sep 17 00:00:00 2001 From: prem315 Date: Wed, 4 Nov 2026 17:21:34 +0530 Subject: [PATCH 1/3] Fix sidebar scroll fade behavior - Reuse the scroll-fade hook for sidebar and settings content - Hide sidebar scrollbars while preserving scrollable content cues --- apps/web/src/components/ui/sidebar.tsx | 6 ++++- apps/web/src/hooks/use-scroll-fade.ts | 31 ++++++++++++++++++++++++++ apps/web/src/settings/layout.tsx | 30 +++++-------------------- apps/web/src/style.css | 4 ++-- 4 files changed, 43 insertions(+), 28 deletions(-) create mode 100644 apps/web/src/hooks/use-scroll-fade.ts diff --git a/apps/web/src/components/ui/sidebar.tsx b/apps/web/src/components/ui/sidebar.tsx index 82423cb7..aa9a9140 100644 --- a/apps/web/src/components/ui/sidebar.tsx +++ b/apps/web/src/components/ui/sidebar.tsx @@ -7,6 +7,7 @@ import { PanelLeftIcon } from "lucide-react"; import { Slot } from "radix-ui"; import { useIsMobile } from "@/hooks/use-mobile"; +import { useScrollFade } from "@/hooks/use-scroll-fade"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Separator } from "@/components/ui/separator"; @@ -437,12 +438,15 @@ function SidebarSeparator({ className, ...props }: React.ComponentProps) { + const viewport = React.useRef(null); + useScrollFade(viewport); return (
) { + useLayoutEffect(() => { + const element = viewport.current; + if (element === null) return; + const update = () => { + element.style.setProperty("--scroll-top", element.scrollTop > 1 ? "transparent" : "black"); + element.style.setProperty( + "--scroll-bottom", + element.scrollTop + element.clientHeight < element.scrollHeight - 1 ? "transparent" : "black", + ); + }; + const resize = new ResizeObserver(update); + const observe = () => { + resize.disconnect(); + resize.observe(element); + for (const child of element.children) resize.observe(child); + update(); + }; + const mutations = new MutationObserver(observe); + mutations.observe(element, { childList: true, subtree: true, characterData: true }); + element.addEventListener("scroll", update, { passive: true }); + observe(); + return () => { + resize.disconnect(); + mutations.disconnect(); + element.removeEventListener("scroll", update); + }; + }, [viewport]); +} diff --git a/apps/web/src/settings/layout.tsx b/apps/web/src/settings/layout.tsx index 318d7979..4302d4ee 100644 --- a/apps/web/src/settings/layout.tsx +++ b/apps/web/src/settings/layout.tsx @@ -1,6 +1,7 @@ import { Link, Outlet, useMatchRoute, useNavigate } from "@tanstack/react-router"; import { Search } from "lucide-react"; -import { useEffect, useRef, useState } from "react"; +import { useRef, useState } from "react"; +import { useScrollFade } from "@/hooks/use-scroll-fade"; import { Sidebar, @@ -90,31 +91,10 @@ export function SettingsSidebar() { export function SettingsLayout() { const viewport = useRef(null); - const content = useRef(null); - useEffect(() => { - const element = viewport.current; - const body = content.current; - if (element === null || body === null) return; - const update = () => { - element.style.setProperty("--scroll-top", element.scrollTop > 1 ? "transparent" : "black"); - element.style.setProperty( - "--scroll-bottom", - element.scrollTop + element.clientHeight < element.scrollHeight - 1 ? "transparent" : "black", - ); - }; - const observer = new ResizeObserver(update); - observer.observe(element); - observer.observe(body); - element.addEventListener("scroll", update, { passive: true }); - update(); - return () => { - observer.disconnect(); - element.removeEventListener("scroll", update); - }; - }, []); + useScrollFade(viewport); return ( -
-
+
+
diff --git a/apps/web/src/style.css b/apps/web/src/style.css index 02a73893..722ceea8 100644 --- a/apps/web/src/style.css +++ b/apps/web/src/style.css @@ -552,8 +552,8 @@ color: color-mix(in srgb, var(--cw-ink) 80%, transparent); } -/* Only soften edges that have more settings content beyond them. */ -.settings-scroll { +/* Only soften edges that have more scrollable content beyond them. */ +.scroll-fade { mask-image: linear-gradient( to bottom, var(--scroll-top, black), From fd00c872adcfd48a362180260a22001becbbda3c Mon Sep 17 00:00:00 2001 From: prem315 Date: Wed, 4 Nov 2026 18:04:26 +0530 Subject: [PATCH 2/3] Add activity loaders for running agent sessions - Track active sessions across views and workspaces - Show animated loader indicators in the sidebar and switcher - Respect reduced-motion preferences --- apps/web/src/components/loader.tsx | 28 ++++++++++++++++++++++++ apps/web/src/landing/sidebar.tsx | 14 +++++++++++- apps/web/src/shell/switcher.tsx | 10 ++++++++- apps/web/src/style.css | 22 +++++++++++++++++++ apps/web/src/widgets/session/projects.ts | 20 ++++++++++++++++- apps/web/src/widgets/session/view.tsx | 11 +++++++--- 6 files changed, 99 insertions(+), 6 deletions(-) create mode 100644 apps/web/src/components/loader.tsx diff --git a/apps/web/src/components/loader.tsx b/apps/web/src/components/loader.tsx new file mode 100644 index 00000000..8d0e4480 --- /dev/null +++ b/apps/web/src/components/loader.tsx @@ -0,0 +1,28 @@ +const pixels = [ + [0, 0], + [6, 0], + [12, 0], + [12, 6], + [12, 12], + [6, 12], + [0, 12], + [0, 6], +] as const; + +export function PixelLoader() { + return ( + + {pixels.map(([x, y], index) => ( + + ))} + + ); +} diff --git a/apps/web/src/landing/sidebar.tsx b/apps/web/src/landing/sidebar.tsx index babb287c..15c3eb58 100644 --- a/apps/web/src/landing/sidebar.tsx +++ b/apps/web/src/landing/sidebar.tsx @@ -15,7 +15,7 @@ import { } from "@/components/ui/sidebar"; import { isMac, openMode } from "@codeworksh/widget/view"; import { sessionAddress } from "../widgets/session/address"; -import { projectsAtom } from "../widgets/session/projects"; +import { projectsAtom, runningAtom } from "../widgets/session/projects"; import { focusedAtom } from "../wm/chrome"; import { deskAtom } from "../wm/instances"; import { useOpenElsewhere } from "../wm/open"; @@ -27,6 +27,7 @@ import { problemAtom } from "../kernel/servers"; import { Empty, EmptyAction } from "./empty"; import { useAddProject } from "../shell/palette"; import { placeAtom } from "./place"; +import { PixelLoader } from "@/components/loader"; /** * Recent sessions across every project, newest first, beside every page. With none yet it invites @@ -35,6 +36,8 @@ import { placeAtom } from "./place"; export function SessionsSidebar() { const result = useAtomValue(projectsAtom); const problem = useAtomValue(problemAtom); + const running = useAtomValue(runningAtom); + const working = new Set(running.values()); const [query, setQuery] = useState(""); const openElsewhere = useOpenElsewhere(); const [place, setPlace] = useAtom(placeAtom); @@ -151,6 +154,15 @@ export function SessionsSidebar() { onAuxClick={(event) => open(session, event)} > + {working.has(session.id) && ( + + + + )} {session.title} diff --git a/apps/web/src/shell/switcher.tsx b/apps/web/src/shell/switcher.tsx index b9b68971..9c5bd530 100644 --- a/apps/web/src/shell/switcher.tsx +++ b/apps/web/src/shell/switcher.tsx @@ -4,7 +4,9 @@ import { AppWindow, X } from "lucide-react"; import { useEffect, useRef } from "react"; import { isMac } from "@codeworksh/widget/view"; +import { PixelLoader } from "@/components/loader"; import { registry } from "../widgets"; +import { runningAtom } from "../widgets/session/projects"; import { chromeAtom, chromeOf, focusedAtom, tabOwnerAtom } from "../wm/chrome"; import { deskAtom, deskKey } from "../wm/instances"; import { @@ -32,6 +34,7 @@ export function Switcher({ workspaces, active }: SwitcherProps) { const chrome = useAtomValue(chromeAtom); const focusedOn = useAtomValue(focusedAtom); const owners = useAtomValue(tabOwnerAtom); + const running = useAtomValue(runningAtom); const navigate = useNavigate(); const remove = useAtomSet(deleteWorkspace, { mode: "promise" }); // No confirm, like a browser tab; closing the one on screen moves to a neighbour first. @@ -103,6 +106,9 @@ export function Switcher({ workspaces, active }: SwitcherProps) { {workspaces.map((workspace, index) => { const current = workspace.id === active?.id; const tab = showing(workspace); + const working = instances.some( + (instance) => (instance.tags & workspaceTag(workspace)) !== 0 && running.has(instance.id), + ); return (
- + {working ? : } {tab} diff --git a/apps/web/src/style.css b/apps/web/src/style.css index 722ceea8..5159d0fb 100644 --- a/apps/web/src/style.css +++ b/apps/web/src/style.css @@ -506,6 +506,28 @@ } } +@media (prefers-reduced-motion: no-preference) { + .pixel-loader-cell { + animation: pixel-loader 960ms steps(1, end) infinite; + } +} + +@keyframes pixel-loader { + 0% { + opacity: 1; + } + 12.5% { + opacity: 0.65; + } + 25% { + opacity: 0.4; + } + 37.5%, + 100% { + opacity: 0.2; + } +} + @keyframes zen-spin { to { transform: rotate(360deg); diff --git a/apps/web/src/widgets/session/projects.ts b/apps/web/src/widgets/session/projects.ts index 8b4df37f..9c518d43 100644 --- a/apps/web/src/widgets/session/projects.ts +++ b/apps/web/src/widgets/session/projects.ts @@ -1,5 +1,6 @@ -import { useAtomValue } from "@effect/atom-react"; +import { useAtomSet, useAtomValue } from "@effect/atom-react"; import { AsyncResult, Atom } from "effect/reactivity"; +import { useEffect } from "react"; import { Server } from "../../kernel/rpc"; import { codeworkKey } from "../../kernel/servers"; @@ -7,6 +8,23 @@ import { codeworkKey } from "../../kernel/servers"; /** Every project with its sessions, as the sidebar lists them; refresh it once a new session exists. */ export const projectsAtom = Server.query("projects.list", undefined, { reactivityKeys: codeworkKey }); +/** Running session frames, keyed by instance so closing one never clears another's activity. */ +export const runningAtom = Atom.make>(new Map()).pipe(Atom.keepAlive); + +export function useSessionRunning(instanceId: string, sessionId: string, running: boolean) { + const setRunning = useAtomSet(runningAtom); + useEffect(() => { + if (!running) return; + setRunning((current) => new Map(current).set(instanceId, sessionId)); + return () => + setRunning((current) => { + const next = new Map(current); + next.delete(instanceId); + return next; + }); + }, [instanceId, sessionId, running, setRunning]); +} + const listedAtom = Atom.family((id: string) => Atom.make((get) => { const result = get(projectsAtom); diff --git a/apps/web/src/widgets/session/view.tsx b/apps/web/src/widgets/session/view.tsx index 46ae28ff..b3742f20 100644 --- a/apps/web/src/widgets/session/view.tsx +++ b/apps/web/src/widgets/session/view.tsx @@ -15,7 +15,7 @@ import { SessionComposer } from "./composer"; import { Markdown } from "./markdown"; import { Message } from "./message"; import { Queue } from "./queue"; -import { projectsAtom, useListedSession } from "./projects"; +import { projectsAtom, useListedSession, useSessionRunning } from "./projects"; import { type Info, Json, type ThreadRef, threadKey, topics, type Update } from "./schema"; const decodeReply = Schema.decodeUnknownOption(Json.Reply); @@ -61,6 +61,11 @@ type State = type Ready = Extract; +const isRunning = (state: Ready) => { + const last = state.messages.at(-1); + return state.running ?? (last?.role === "assistant" && last.state === "draft"); +}; + /* * The threads opened lately, as last shown: switching back to one renders it on the first frame * while it catches up, instead of an empty frame until its first page loads. @@ -378,6 +383,7 @@ function Conversation({ : loaded.queued, }; }, [loaded, sent]); + useSessionRunning(instanceId, thread.sessionId, state.status === "ready" && isRunning(state)); const sending = useCallback( (prompt: { readonly id: string; readonly text: string; readonly createdAt: number }) => setSent((current) => [ @@ -463,8 +469,7 @@ function Conversation({ const view = stand ?? state; if (view.status === "loading") return ; if (view.status === "failed") return

{view.message}

; - const last = view.messages.at(-1); - const running = view.running ?? (last?.role === "assistant" && last.state === "draft"); + const running = isRunning(view); return (
From 650ca96ba4464f969e2e876637f4cb8edb1ac3e1 Mon Sep 17 00:00:00 2001 From: prem315 Date: Wed, 4 Nov 2026 18:29:09 +0530 Subject: [PATCH 3/3] Replace work log image with reusable Logo component - Add a crisp pixel-style Logo component - Use it in expandable session work logs --- apps/web/src/components/logo.tsx | 15 +++++++++++++++ apps/web/src/widgets/session/view.tsx | 12 +++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100644 apps/web/src/components/logo.tsx diff --git a/apps/web/src/components/logo.tsx b/apps/web/src/components/logo.tsx new file mode 100644 index 00000000..5f398689 --- /dev/null +++ b/apps/web/src/components/logo.tsx @@ -0,0 +1,15 @@ +/** The pixel C and square dot from the site's brand/logo.svg. */ +export function Logo({ className = "" }: { readonly className?: string }) { + return ( + + + + + ); +} diff --git a/apps/web/src/widgets/session/view.tsx b/apps/web/src/widgets/session/view.tsx index b3742f20..e1146d3a 100644 --- a/apps/web/src/widgets/session/view.tsx +++ b/apps/web/src/widgets/session/view.tsx @@ -6,7 +6,7 @@ import { Atom } from "effect/reactivity"; import { ChevronRight, CircleDashed, X } from "lucide-react"; import { createContext, memo, use, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react"; -import brand from "../../assets/codework.png"; +import { Logo } from "@/components/logo"; import { ComposerNotice, type Notice } from "@/components/banner"; import { Monogram } from "@/components/monogram"; import { useModelName, useModelsNotice } from "@/components/model"; @@ -1112,10 +1112,12 @@ function WorkLog({ ) : ( <> - {expandable && (