Skip to content

The agent that grows with you

style(kanban): make the comment action an inset icon button in the field

Calvin Ngef2307dde3ff
diff --git a/apps/desktop/src/plugins/kanban/drawer.test.tsx b/apps/desktop/src/plugins/kanban/drawer.test.tsx
index 085cdb53850..e2dd19216c9 100644
--- a/apps/desktop/src/plugins/kanban/drawer.test.tsx
+++ b/apps/desktop/src/plugins/kanban/drawer.test.tsx
@@ -34,6 +34,10 @@ const rest = vi.fn(async (path: string, options?: PluginRestOptions): Promise<un
return { ok: true }
}
+ if (path.startsWith('/tasks/t_example/comments') && options?.method === 'POST') {
+ return { ok: true }
+ }
+
if (path === '/tasks/t_example') {
return detail
}
@@ -144,6 +148,24 @@ describe('task modal dialog', () => {
expect(onClose).toHaveBeenCalledOnce()
})
+ it('posts a comment from the named icon action in the field', async () => {
+ detail = { ...legacyDetail, attachments: [] }
+ openDrawer()
+
+ const send = await screen.findByRole('button', { name: en.comment })
+ expect((send as HTMLButtonElement).disabled).toBe(true)
+
+ fireEvent.change(screen.getByPlaceholderText(en.addComment), { target: { value: 'looks good' } })
+ fireEvent.click(send)
+
+ await waitFor(() =>
+ expect(rest).toHaveBeenCalledWith(
+ expect.stringMatching(/^\/tasks\/t_example\/comments/),
+ expect.objectContaining({ method: 'POST', body: expect.objectContaining({ body: 'looks good' }) })
+ )
+ )
+ })
+
it('shows the workspace path as its own value, not prefixed with the raw kind', async () => {
const path = '/Users/example/.hermes/kanban/workspaces/a_very_long_directory_name_that_must_wrap'
detail = {
diff --git a/apps/desktop/src/plugins/kanban/drawer.tsx b/apps/desktop/src/plugins/kanban/drawer.tsx
index fd44444b8cf..febcd8f848d 100644
--- a/apps/desktop/src/plugins/kanban/drawer.tsx
+++ b/apps/desktop/src/plugins/kanban/drawer.tsx
@@ -366,11 +366,17 @@ function CommentComposer({
}
}
+ const empty = !body.trim() || pending
+ const sendLabel = running ? k.send : k.comment
+
+ // Sized like the new-project idea field (default control padding, inset icon
+ // action); a labelled text button floating inside the textarea read as part
+ // of the input.
return (
<div className="flex flex-col gap-1.5">
<div className="relative">
<Textarea
- className={cn('field-sizing-content max-h-40 min-h-0 resize-none', running ? 'pr-[3.5rem]' : 'pr-[5rem]')}
+ className="field-sizing-content max-h-40 resize-none pr-9 text-[0.8125rem]"
onChange={event => setBody(event.target.value)}
onKeyDown={event => {
if (isSubmitEnter(event) && !event.shiftKey) {
@@ -379,24 +385,26 @@ function CommentComposer({
}
}}
placeholder={running ? k.messageWorker : k.addComment}
- rows={1}
- size="sm"
value={body}
/>
- <Button
- className="absolute top-1 right-1"
- disabled={!body.trim() || pending}
- onClick={submit}
- size="xs"
- variant="secondary"
- >
- {running ? k.send : k.comment}
- </Button>
+ <Tip label={sendLabel}>
+ <Button
+ aria-label={sendLabel}
+ className="absolute top-1 right-1 text-muted-foreground/80 hover:text-foreground"
+ disabled={empty}
+ onClick={submit}
+ size="icon-xs"
+ type="button"
+ variant="ghost"
+ >
+ <Codicon name="arrow-up" size="0.85rem" />
+ </Button>
+ </Tip>
</div>
{running && onRequeue && (
<div className="flex items-center justify-between gap-2">
<span className="text-[0.625rem] leading-tight text-(--ui-text-quaternary)">{k.deliveredLive}</span>
- <Button className="shrink-0" disabled={!body.trim() || pending} onClick={requeue} size="xs" variant="outline">
+ <Button className="shrink-0" disabled={empty} onClick={requeue} size="xs" variant="outline">
<Codicon name="debug-restart" size="0.7rem" />
{k.requeueWithNote}
</Button>
@@ -667,7 +675,7 @@ function FeedTabs({
)
const body = (
- <div className="flex flex-col gap-3">
+ <div className="flex flex-col gap-4">
{tab === 'comments' && (
<>
{detail.comments.length > 0 && (