Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions src/components/ComposerQueuedMessages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,16 @@ describe("QueuedComposerMessages", () => {
expect(withoutEdit).not.toContain("Edit queued message");
});

it("says the fallback Steer stops the running turn when the engine cannot steer live", () => {
it("shows Stop and send on the button when the engine cannot steer live", () => {
const base = { items: oneItem, onSteer: () => undefined, onCancel: () => undefined } as const;
const liveMarkup = renderToStaticMarkup(createElement(QueuedComposerMessages, base));
expect(liveMarkup).toContain("aria-label=\"Steer queued message now\"");
const interruptMarkup = renderToStaticMarkup(
createElement(QueuedComposerMessages, { ...base, steerInterrupts: true }),
);
expect(interruptMarkup).toContain("aria-label=\"Stop the running turn and send this message now\"");
expect(interruptMarkup).toContain(">Stop and send</button>");
expect(interruptMarkup).toContain('aria-label="Stop and send"');
expect(interruptMarkup).toContain('title="Stop the running turn and send this message now"');
expect(interruptMarkup).not.toContain("aria-label=\"Steer queued message now\"");
});

Expand Down Expand Up @@ -174,10 +176,24 @@ describe("QueuedComposerMessages", () => {
onCancel: () => undefined,
}),
);
expect(markup).toContain("aria-label=\"Stop the running turn and send the next queued message now\"");
expect(markup).toContain(">Stop and send next</button>");
expect(markup).toContain('aria-label="Stop and send next"');
expect(markup).toContain('title="Stop the running turn and send the next queued message now"');
expect(markup).not.toContain("aria-label=\"Steer the next queued message now\"");
});

it("shows Stop and send all when the action will stop the turn and drain the direct queue", () => {
const markup = renderToStaticMarkup(createElement(QueuedComposerMessages, {
items: [{ queueId: "q1", text: "first" }, { queueId: "q2", text: "second" }],
onSteer: () => undefined,
onCancel: () => undefined,
steerInterrupts: true,
}));
expect(markup).toContain(">Stop and send all</button>");
expect(markup).toContain('aria-label="Stop and send all"');
expect(markup).toContain('title="Stop the running turn and send all 2 queued messages now"');
});

it("puts the queue-level Steer action on the head only and keeps every delete distinct", () => {
const markup = renderToStaticMarkup(
createElement(QueuedComposerMessages, {
Expand Down
16 changes: 10 additions & 6 deletions src/components/ComposerQueuedMessages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ export function QueuedComposerMessages({
const multiple = items.length > 1;
const steerLabel = steering
? t("composer.queued.steering")
: multiple
? steerMode === "all"
? t("composer.queued.steerAll")
: t("composer.queued.steerNext")
: t("composer.queued.steer");
: steerInterrupts
? multiple
? t(steerMode === "all" ? "composer.queued.stopAndSendAll" : "composer.queued.stopAndSendNext")
: t("composer.queued.stopAndSend")
: multiple
? steerMode === "all"
? t("composer.queued.steerAll")
: t("composer.queued.steerNext")
: t("composer.queued.steer");
const steerDescription = steerInterrupts
? multiple
? steerMode === "all"
Expand Down Expand Up @@ -122,7 +126,7 @@ export function QueuedComposerMessages({
type="button"
onClick={onSteer}
disabled={steering}
aria-label={steering ? t("composer.queued.steeringAria") : steerDescription}
aria-label={steering ? t("composer.queued.steeringAria") : steerInterrupts ? steerLabel : steerDescription}
title={steerDescription}
className="flex h-7 shrink-0 items-center gap-1 rounded-lg px-2 text-[13px] font-medium text-ink-secondary outline-none hover:bg-raised-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-accent/60 disabled:cursor-wait disabled:opacity-60"
>
Expand Down
3 changes: 3 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2941,6 +2941,9 @@
"composer.queued.steerAll": "Steer all",
"composer.queued.steerNext": "Steer next",
"composer.queued.steer": "Steer",
"composer.queued.stopAndSend": "Stop and send",
"composer.queued.stopAndSendAll": "Stop and send all",
"composer.queued.stopAndSendNext": "Stop and send next",
"composer.queued.steerAllHint": "Steer all {count} queued messages now",
"composer.queued.steerNextHint": "Steer the next queued message now",
"composer.queued.steerHint": "Steer queued message now",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -2806,6 +2806,9 @@
"composer.queued.steerAll": "Enviar todas agora",
"composer.queued.steerNext": "Enviar a próxima agora",
"composer.queued.steer": "Enviar agora",
"composer.queued.stopAndSend": "Parar e enviar",
"composer.queued.stopAndSendAll": "Parar e enviar todas",
"composer.queued.stopAndSendNext": "Parar e enviar a próxima",
"composer.queued.steerAllHint": "Enviar agora todas as {count} mensagens na fila",
"composer.queued.steerNextHint": "Enviar agora a próxima mensagem da fila",
"composer.queued.steerHint": "Enviar agora a mensagem da fila",
Expand Down
6 changes: 6 additions & 0 deletions src/locales/source-hashes.json
Original file line number Diff line number Diff line change
Expand Up @@ -26453,6 +26453,9 @@
"composer.queued.steerAll": "3dbef7d2b69f32c426094bec3d3001a2e9f1abe560012c9d9cded8d0cbc2985d",
"composer.queued.steerNext": "bbe9e8b657832c304ffe5e845ae93dca1e1c706af1fa7f2304bb575845d6cfca",
"composer.queued.steer": "1cf39ed452541de41e0b1688ef67a1eb19c8823d8de23e2a05a5e9b95192901b",
"composer.queued.stopAndSend": "87c1a8d4e59f78757cd4549151cb0d736016067816c2ff780b121616144f9331",
"composer.queued.stopAndSendAll": "58414c1551260488f933d956477c5fef7a27cbcf9ed1614b688bb81b79fe4350",
"composer.queued.stopAndSendNext": "02338a95dff6690ac551c64e81e1765afc5e69326918bca87ee64b189e074a6e",
"composer.queued.steerAllHint": "74ec9088c53719d75e98026973d2ddfe69602cf824de02935641b84d49fe031b",
"composer.queued.steerNextHint": "e16f53cc7499a295cc0e1fc8ed25a8970e84e35bb9e488f688c68ffeb8c2ec5d",
"composer.queued.steerHint": "27b97eb3726a423c9e471a8020b68426f1f429da79d131099c1e67340c5d9348",
Expand Down Expand Up @@ -42757,6 +42760,9 @@
"composer.queued.steerAll": "3dbef7d2b69f32c426094bec3d3001a2e9f1abe560012c9d9cded8d0cbc2985d",
"composer.queued.steerNext": "bbe9e8b657832c304ffe5e845ae93dca1e1c706af1fa7f2304bb575845d6cfca",
"composer.queued.steer": "1cf39ed452541de41e0b1688ef67a1eb19c8823d8de23e2a05a5e9b95192901b",
"composer.queued.stopAndSend": "87c1a8d4e59f78757cd4549151cb0d736016067816c2ff780b121616144f9331",
"composer.queued.stopAndSendAll": "58414c1551260488f933d956477c5fef7a27cbcf9ed1614b688bb81b79fe4350",
"composer.queued.stopAndSendNext": "02338a95dff6690ac551c64e81e1765afc5e69326918bca87ee64b189e074a6e",
"composer.queued.steerAllHint": "74ec9088c53719d75e98026973d2ddfe69602cf824de02935641b84d49fe031b",
"composer.queued.steerNextHint": "e16f53cc7499a295cc0e1fc8ed25a8970e84e35bb9e488f688c68ffeb8c2ec5d",
"composer.queued.steerHint": "27b97eb3726a423c9e471a8020b68426f1f429da79d131099c1e67340c5d9348",
Expand Down
3 changes: 3 additions & 0 deletions src/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -2875,6 +2875,9 @@
"composer.queued.steerAll": "全部引導",
"composer.queued.steerNext": "引導下一則",
"composer.queued.steer": "引導",
"composer.queued.stopAndSend": "停止並傳送",
"composer.queued.stopAndSendAll": "停止並傳送全部",
"composer.queued.stopAndSendNext": "停止並傳送下一則",
"composer.queued.steerAllHint": "立即引導佇列中全部 {count} 則訊息",
"composer.queued.steerNextHint": "立即引導佇列中的下一則訊息",
"composer.queued.steerHint": "立即引導佇列中的訊息",
Expand Down
Loading