Skip to content

An open-source, faster Devin alternative

TypeScript

web: triage dock wraps on narrow screens, excerpt stays pinned to its end, single-choice legend

Igor Zalutski via Computer00a6aa553b0c
diff --git a/web/src/managed-agents/computer-sessions/AnswerDock.tsx b/web/src/managed-agents/computer-sessions/AnswerDock.tsx
index 00815f98..89812a09 100644
--- a/web/src/managed-agents/computer-sessions/AnswerDock.tsx
+++ b/web/src/managed-agents/computer-sessions/AnswerDock.tsx
@@ -202,7 +202,7 @@ export function AnswerDock({
className="min-h-11 resize-none border-0 bg-transparent px-4 pt-3 pb-1 leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"
/>
- <div className="flex items-center gap-2 px-2 pb-2">
+ <div className="flex flex-wrap items-center gap-2 px-2 pb-2">
{gone ? null : (
<Button
size="sm"
@@ -214,7 +214,7 @@ export function AnswerDock({
{entry.aside ? 'Bring back' : 'Set aside'}
</Button>
)}
- <div className="ml-auto flex items-center gap-2">
+ <div className="ml-auto flex flex-wrap items-center justify-end gap-2 max-sm:has-[>button:nth-of-type(2)]:w-full max-sm:[&>button]:flex-auto">
{act.isError ? (
<p
role="alert"
@@ -368,16 +368,14 @@ function Options({
const box = question.multiSelect
return (
<fieldset className="space-y-2">
- {titled || box ? (
- <legend className="text-muted-foreground mb-2 flex gap-2 text-xs">
- {titled ? (
- <span className="text-foreground font-medium">
- {question.text || question.header}
- </span>
- ) : null}
- {box ? <span>Choose any</span> : null}
- </legend>
- ) : null}
+ <legend className="text-muted-foreground mb-2 flex gap-2 text-xs">
+ {titled ? (
+ <span className="text-foreground font-medium">
+ {question.text || question.header}
+ </span>
+ ) : null}
+ <span>{box ? 'Choose any' : 'Choose one'}</span>
+ </legend>
<div className="divide-y overflow-hidden rounded-lg border">
{question.options.map((o) => {
const on = chosen.includes(o.label)
diff --git a/web/src/managed-agents/computer-sessions/Triage.tsx b/web/src/managed-agents/computer-sessions/Triage.tsx
index 1fdb5c38..2dc10d22 100644
--- a/web/src/managed-agents/computer-sessions/Triage.tsx
+++ b/web/src/managed-agents/computer-sessions/Triage.tsx
@@ -454,11 +454,26 @@ function Conversation({
}, [events, turnId])
const earlier = page.data?.earlierTurns?.length ?? 0
+ // Kept scrolled to the end while it grows or the window changes, unless
+ // the person has scrolled up to read.
const scroller = useRef<HTMLDivElement>(null)
+ const pinned = useRef(true)
useLayoutEffect(() => {
const el = scroller.current
if (el) el.scrollTop = el.scrollHeight
+ pinned.current = true
}, [before.length, after.length])
+ useEffect(() => {
+ const el = scroller.current
+ if (!el || typeof ResizeObserver === 'undefined') return
+ const pin = () => {
+ if (pinned.current) el.scrollTop = el.scrollHeight
+ }
+ const ro = new ResizeObserver(pin)
+ ro.observe(el)
+ if (el.firstElementChild) ro.observe(el.firstElementChild)
+ return () => ro.disconnect()
+ }, [])
const items = (list: typeof before) =>
list.map((item, i) => (
@@ -474,6 +489,10 @@ function Conversation({
<section
aria-label="Conversation"
ref={scroller}
+ onScroll={(e) => {
+ const el = e.currentTarget
+ pinned.current = el.scrollHeight - el.scrollTop - el.clientHeight < 8
+ }}
className="-mx-2 mt-2 min-h-0 flex-1 overflow-y-auto [mask-image:linear-gradient(to_bottom,transparent,black_24px)] px-2"
>
<div className="flex min-h-full flex-col justify-end gap-5 pt-6 pb-1">