diff options
| author | Adam Malczewski <[email protected]> | 2026-10-21 14:26:35 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-10-21 14:26:35 +0900 |
| commit | 8eefbc5287f73414df7feba6c78dc8ca73783b1d (patch) | |
| tree | ecb0b0286f22eb082c8c4cce6adf1d535b0b7fed /src/features/chat/logic | |
| parent | a7b041f0f8989373404c35d3fe4b20b1e89d2440 (diff) | |
| download | dispatch-web-8eefbc5287f73414df7feba6c78dc8ca73783b1d.tar.gz dispatch-web-8eefbc5287f73414df7feba6c78dc8ca73783b1d.zip | |
fix(review-followup-fea): clarify Stop with queued input
Diffstat (limited to 'src/features/chat/logic')
| -rw-r--r-- | src/features/chat/logic/composer.test.ts | 20 | ||||
| -rw-r--r-- | src/features/chat/logic/composer.ts | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/features/chat/logic/composer.test.ts b/src/features/chat/logic/composer.test.ts new file mode 100644 index 0000000..6ef5eab --- /dev/null +++ b/src/features/chat/logic/composer.test.ts @@ -0,0 +1,20 @@ +import { describe, expect, it } from "vitest"; +import { stopButtonLabels } from "./composer"; + +describe("stopButtonLabels", () => { + it.each([undefined, 0])("preserves plain Stop with queued count %s", (count) => { + expect(stopButtonLabels(count)).toEqual({ + text: "Stop", + ariaLabel: "Stop generation", + title: undefined, + }); + }); + + it.each([1, 2])("describes interrupt-and-send with queued count %s", (count) => { + expect(stopButtonLabels(count)).toEqual({ + text: "Interrupt & send queued", + ariaLabel: "Interrupt & send queued", + title: "Stop the current response and start the queued message now", + }); + }); +}); diff --git a/src/features/chat/logic/composer.ts b/src/features/chat/logic/composer.ts new file mode 100644 index 0000000..1ea8173 --- /dev/null +++ b/src/features/chat/logic/composer.ts @@ -0,0 +1,11 @@ +/** Stop still uses the same action; the backend carries queued input into a new turn. */ +export function stopButtonLabels(queuedMessageCount: number | undefined) { + if (queuedMessageCount !== undefined && queuedMessageCount >= 1) { + return { + text: "Interrupt & send queued", + ariaLabel: "Interrupt & send queued", + title: "Stop the current response and start the queued message now", + }; + } + return { text: "Stop", ariaLabel: "Stop generation", title: undefined }; +} |
