GeezerVison is showing github.com — fix(web,mobile): queued messages get a simpler Send now row, no reord… · pingdotgg/t3code@92e6450
File treeExpand file treeCollapse file tree Open diff view settings mobile/src/features/threads
packages/client-runtime/src
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/ThreadQueueControl.tsx +99-333Lines changed: 99 additions & 333 deletions Large diffs are not rendered by default. Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/floating-working-control.tsx +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -243,7 +243,7 @@ export function FloatingWorkingControl(props: { | 243 | 243 | <Pressable | 244 | 244 | accessibilityRole="button" | 245 | 245 | accessibilityLabel={`Open queue, ${props.queuedCount} messages`} | 246 | | - accessibilityHint="Opens queued messages for reordering, steering, or removal" | | 246 | + accessibilityHint="Opens queued messages to send now, edit, or remove" | 247 | 247 | onPress={props.onOpenQueue} | 248 | 248 | onLayout={(event) => setQueueWidth(settleWidth(event.nativeEvent.layout.width))} | 249 | 249 | style={{ maxWidth: Math.min(overlayWidth, windowWidth) * 0.45 }} | |
Collapse file Copy file name to clipboard +1-38Lines changed: 1 addition & 38 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import { formatAssistantCitationHref } from "@t3tools/shared/assistantCitations"; | 2 | 2 | import { describe, expect, it } from "vite-plus/test"; | 3 | 3 |
| 4 | | -import { | 5 | | - resolveThreadQueueRowControls, | 6 | | - resolveQueueDropBeforeRunId, | 7 | | -} from "./threadQueueControlPresentation"; | | 4 | +import { resolveThreadQueueRowControls } from "./threadQueueControlPresentation"; | 8 | 5 |
| 9 | 6 | describe("threadQueueControlPresentation", () => { | 10 | 7 | it.each([ | @@ -19,9 +16,6 @@ describe("threadQueueControlPresentation", () => { | 19 | 16 | isEditing, | 20 | 17 | canPromoteToSteer: false, | 21 | 18 | canSendNow: true, | 22 | | - canReorder: false, | 23 | | - index: 0, | 24 | | - queuedCount: 1, | 25 | 19 | text: "Queued message", | 26 | 20 | }); | 27 | 21 |
| @@ -45,9 +39,6 @@ describe("threadQueueControlPresentation", () => { | 45 | 39 | busy: false, | 46 | 40 | canPromoteToSteer: true, | 47 | 41 | canSendNow: false, | 48 | | - canReorder: true, | 49 | | - index: 0, | 50 | | - queuedCount: 1, | 51 | 42 | text: `[Assistant quote](${href}) Can we add a backoff here?`, | 52 | 43 | }); | 53 | 44 |
| @@ -61,17 +52,13 @@ describe("threadQueueControlPresentation", () => { | 61 | 52 | busy: false, | 62 | 53 | canPromoteToSteer: true, | 63 | 54 | canSendNow: false, | 64 | | - canReorder: true, | 65 | | - index: 1, | 66 | 55 | isEditing: true, | 67 | | - queuedCount: 3, | 68 | 56 | text: "Being edited", | 69 | 57 | }); | 70 | 58 |
| 71 | 59 | expect(editing.isEditing).toBe(true); | 72 | 60 | expect(editing.canEdit).toBe(false); | 73 | 61 | expect(editing.canSend).toBe(false); | 74 | | - expect(editing.canMoveUp).toBe(true); | 75 | 62 | expect(editing.canDismiss).toBe(true); | 76 | 63 | }); | 77 | 64 |
| @@ -80,35 +67,11 @@ describe("threadQueueControlPresentation", () => { | 80 | 67 | busy: false, | 81 | 68 | canPromoteToSteer: true, | 82 | 69 | canSendNow: false, | 83 | | - canReorder: true, | 84 | | - index: 0, | 85 | 70 | isGuestMessage: true, | 86 | | - queuedCount: 1, | 87 | 71 | text: "Why?", | 88 | 72 | }); | 89 | 73 |
| 90 | 74 | expect(guest.canEdit).toBe(false); | 91 | 75 | expect(guest.canDismiss).toBe(true); | 92 | 76 | }); | 93 | 77 | }); | 94 | | - | 95 | | -describe("queue drag insertion", () => { | 96 | | - const rows = [ | 97 | | - { id: "first" as never, y: 0, height: 80 }, | 98 | | - { id: "second" as never, y: 80, height: 140 }, | 99 | | - { id: "third" as never, y: 220, height: 80 }, | 100 | | - ]; | 101 | | - | 102 | | - it("moves between variable-height rows and to either end", () => { | 103 | | - expect(resolveQueueDropBeforeRunId(rows, rows[0]!.id, 140)).toBe("third"); | 104 | | - expect(resolveQueueDropBeforeRunId(rows, rows[0]!.id, 300)).toBeNull(); | 105 | | - expect(resolveQueueDropBeforeRunId(rows, rows[2]!.id, -300)).toBe("first"); | 106 | | - }); | 107 | | - | 108 | | - it("does not send a reorder for an unchanged or unmeasured drop", () => { | 109 | | - expect(resolveQueueDropBeforeRunId(rows, rows[1]!.id, 0)).toBeUndefined(); | 110 | | - expect(resolveQueueDropBeforeRunId(rows, rows[2]!.id, 20)).toBeUndefined(); | 111 | | - expect(resolveQueueDropBeforeRunId([{ id: rows[0]!.id }], rows[0]!.id, 10)).toBeUndefined(); | 112 | | - expect(resolveQueueDropBeforeRunId(rows, "missing" as never, 100)).toBeUndefined(); | 113 | | - }); | 114 | | -}); |
Collapse file Copy file name to clipboardExpand all lines: apps/mobile/src/features/threads/threadQueueControlPresentation.ts -31Lines changed: 0 additions & 31 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -6,8 +6,6 @@ export const REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL = "Remove queued message" | 6 | 6 | export interface ThreadQueueRowControls { | 7 | 7 | readonly canDismiss: boolean; | 8 | 8 | readonly canEdit: boolean; | 9 | | - readonly canMoveDown: boolean; | 10 | | - readonly canMoveUp: boolean; | 11 | 9 | readonly canSend: boolean; | 12 | 10 | readonly dismissAccessibilityLabel: string; | 13 | 11 | readonly displayText: string; | @@ -18,14 +16,11 @@ export function resolveThreadQueueRowControls(input: { | 18 | 16 | readonly busy: boolean; | 19 | 17 | readonly canPromoteToSteer: boolean; | 20 | 18 | readonly canSendNow: boolean; | 21 | | - readonly canReorder: boolean; | 22 | 19 | /** Something else holds the composer, such as an open question. */ | 23 | 20 | readonly editBlocked?: boolean; | 24 | | - readonly index: number; | 25 | 21 | readonly isEditing?: boolean; | 26 | 22 | /** A guest's message keeps the guest's words; the owner can cancel it, not rewrite it. */ | 27 | 23 | readonly isGuestMessage?: boolean; | 28 | | - readonly queuedCount: number; | 29 | 24 | readonly text: string; | 30 | 25 | }): ThreadQueueRowControls { | 31 | 26 | const mutationEnabled = !input.busy; | @@ -37,8 +32,6 @@ export function resolveThreadQueueRowControls(input: { | 37 | 32 | // away whatever has been typed since. | 38 | 33 | canEdit: | 39 | 34 | mutationEnabled && !isEditing && input.isGuestMessage !== true && input.editBlocked !== true, | 40 | | - canMoveDown: mutationEnabled && input.canReorder && input.index < input.queuedCount - 1, | 41 | | - canMoveUp: mutationEnabled && input.canReorder && input.index > 0, | 42 | 35 | canSend: mutationEnabled && (input.canPromoteToSteer || input.canSendNow) && !isEditing, | 43 | 36 | dismissAccessibilityLabel: REMOVE_QUEUED_MESSAGE_ACCESSIBILITY_LABEL, | 44 | 37 | // Editing and sending keep the original text so quoted citations stay linked. | @@ -66,27 +59,3 @@ export function buildCancelQueuedRunCommand(input: { | 66 | 59 | }, | 67 | 60 | }; | 68 | 61 | } | 69 | | - | 70 | | -export function resolveQueueDragBeforeRunId( | 71 | | - rows: ReadonlyArray<{ id: RunId; y?: number; height?: number }>, | 72 | | - runId: RunId, | 73 | | - translationY: number, | 74 | | -): RunId | null | undefined { | 75 | | - const sourceIndex = rows.findIndex((row) => row.id === runId); | 76 | | - const source = rows[sourceIndex]; | 77 | | - if (!source || rows.some((row) => row.y === undefined || row.height === undefined)) return; | 78 | | - const center = source.y! + source.height! / 2 + translationY; | 79 | | - const remaining = rows.filter((row) => row.id !== runId); | 80 | | - return remaining.find((row) => center < row.y! + row.height! / 2)?.id ?? null; | 81 | | -} | 82 | | - | 83 | | -export function resolveQueueDropBeforeRunId( | 84 | | - rows: ReadonlyArray<{ id: RunId; y?: number; height?: number }>, | 85 | | - runId: RunId, | 86 | | - translationY: number, | 87 | | -): RunId | null | undefined { | 88 | | - const before = resolveQueueDragBeforeRunId(rows, runId, translationY); | 89 | | - if (before === undefined) return; | 90 | | - const sourceIndex = rows.findIndex((row) => row.id === runId); | 91 | | - return before === (rows[sourceIndex + 1]?.id ?? null) ? undefined : before; | 92 | | -} |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/QueuedRunsControl.browser.test.tsx -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -71,7 +71,6 @@ it("previews assistant quotes as readable text and preserves the citation when e | 71 | 71 | state.workflow = { | 72 | 72 | activeRun: { id: "run:active" }, | 73 | 73 | canPromoteToSteer: true, | 74 | | - canReorder: true, | 75 | 74 | queuedRuns: [ | 76 | 75 | { | 77 | 76 | run: { id: "run:quote-only", userMessageId: "message:quote-only" }, | |
|