The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): make LogsPane text selectable and add autoscroll
JonthanaHanh8f49166a54c0
diff --git a/apps/desktop/src/app/contrib/panes.tsx b/apps/desktop/src/app/contrib/panes.tsxindex 8a6c40b485b..07626490dfa 100644--- a/apps/desktop/src/app/contrib/panes.tsx+++ b/apps/desktop/src/app/contrib/panes.tsx@@ -11,7 +11,7 @@import { useStore } from '@nanostores/react'import { useQuery } from '@tanstack/react-query'import { atom } from 'nanostores'-import { useMemo } from 'react'+import { useEffect, useMemo, useRef } from 'react'import { RightSidebarPane } from '@/app/right-sidebar'import { ReviewPane } from '@/app/right-sidebar/review'@@ -34,6 +34,8 @@ import { $focusedWorkspaceCwd } from '@/store/session-states'// the controller) — never in a default layout, never a standing tab.// ---------------------------------------------------------------------------+const LOGS_BOTTOM_THRESHOLD = 48+export function LogsPane() {const { data, error } = useQuery({queryKey: ['contrib-logs-tail'],@@ -41,6 +43,27 @@ export function LogsPane() {refetchInterval: 5000})+ const preRef = useRef<HTMLPreElement>(null)+ const shouldStickRef = useRef(true)++ // Stick-to-bottom: auto-scroll when the user is already near the bottom.+ useEffect(() => {+ const el = preRef.current+ if (!el || !shouldStickRef.current) return++ const raf = requestAnimationFrame(() => {+ el.scrollTo({ top: el.scrollHeight })+ })+ return () => cancelAnimationFrame(raf)+ }, [data])++ function handleScroll() {+ const el = preRef.current+ if (!el) return+ shouldStickRef.current =+ el.scrollHeight - el.scrollTop - el.clientHeight <= LOGS_BOTTOM_THRESHOLD+ }+if (error) {return <div className="p-3 text-xs text-(--ui-text-quaternary)">log unavailable: {String(error)}</div>}@@ -56,7 +79,12 @@ export function LogsPane() {// No chrome of its own — the zone header (when the user summons it) is the// pane's only label. Just the tail.return (- <pre className="h-full min-h-0 overflow-auto whitespace-pre-wrap break-words p-2.5 font-mono text-[0.66rem] leading-relaxed text-(--ui-text-secondary)">+ <pre+ ref={preRef}+ data-selectable-text="true"+ onScroll={handleScroll}+ className="h-full min-h-0 overflow-auto whitespace-pre-wrap break-words p-2.5 font-mono text-[0.66rem] leading-relaxed text-(--ui-text-secondary)"+ >{data.lines.join('\n')}</pre>)