Skip to content

Commit d19e592

Browse files
authored
Merge branch 'main' into feature/assistant-copy-state
2 parents 4994126 + 28e481e commit d19e592

6 files changed

Lines changed: 130 additions & 2 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "T3 Code Dev",
3+
"image": "debian:bookworm",
4+
"features": {
5+
"ghcr.io/devcontainers-extra/features/bun:1": {},
6+
"ghcr.io/devcontainers/features/node:1": {
7+
"version": "24",
8+
"nodeGypDependencies": true
9+
},
10+
"ghcr.io/devcontainers/features/python:1": {
11+
"version": "3.12"
12+
}
13+
},
14+
"postCreateCommand": {
15+
"bun-install": "bun install --backend=copyfile --frozen-lockfile"
16+
},
17+
"customizations": {
18+
"vscode": {
19+
"extensions": ["oxc.oxc-vscode"]
20+
}
21+
}
22+
}

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jobs:
1010
quality:
1111
name: Format, Lint, Typecheck, Test, Browser Test, Build
1212
runs-on: blacksmith-4vcpu-ubuntu-2404
13+
timeout-minutes: 10
1314
steps:
1415
- name: Checkout
1516
uses: actions/checkout@v6
@@ -76,6 +77,7 @@ jobs:
7677
release_smoke:
7778
name: Release Smoke
7879
runs-on: ubuntu-24.04
80+
timeout-minutes: 10
7981
steps:
8082
- name: Checkout
8183
uses: actions/checkout@v6

.github/workflows/release.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
preflight:
2020
name: Preflight
2121
runs-on: ubuntu-24.04
22+
timeout-minutes: 10
2223
outputs:
2324
version: ${{ steps.release_meta.outputs.version }}
2425
tag: ${{ steps.release_meta.outputs.tag }}
@@ -81,6 +82,7 @@ jobs:
8182
name: Build ${{ matrix.label }}
8283
needs: preflight
8384
runs-on: ${{ matrix.runner }}
85+
timeout-minutes: 30
8486
strategy:
8587
fail-fast: false
8688
matrix:
@@ -227,6 +229,7 @@ jobs:
227229
name: Publish CLI to npm
228230
needs: [preflight, build]
229231
runs-on: ubuntu-24.04
232+
timeout-minutes: 10
230233
steps:
231234
- name: Checkout
232235
uses: actions/checkout@v6
@@ -260,6 +263,7 @@ jobs:
260263
name: Publish GitHub Release
261264
needs: [preflight, build, publish_cli]
262265
runs-on: ubuntu-24.04
266+
timeout-minutes: 10
263267
steps:
264268
- name: Checkout
265269
uses: actions/checkout@v6
@@ -307,6 +311,7 @@ jobs:
307311
name: Finalize release
308312
needs: [preflight, release]
309313
runs-on: ubuntu-24.04
314+
timeout-minutes: 10
310315
steps:
311316
- id: app_token
312317
name: Mint release app token

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ apps/web/src/components/__screenshots__
2121
.vitest-*
2222
__screenshots__/
2323
.tanstack
24+
squashfs-root/
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
import { describe, expect, it } from "vitest";
2+
3+
import { formatPendingPrimaryActionLabel } from "./ComposerPrimaryActions";
4+
5+
describe("formatPendingPrimaryActionLabel", () => {
6+
it("returns 'Submitting...' while responding", () => {
7+
expect(
8+
formatPendingPrimaryActionLabel({
9+
compact: false,
10+
isLastQuestion: false,
11+
isResponding: true,
12+
questionIndex: 0,
13+
}),
14+
).toBe("Submitting...");
15+
});
16+
17+
it("returns 'Submitting...' while responding regardless of other flags", () => {
18+
expect(
19+
formatPendingPrimaryActionLabel({
20+
compact: true,
21+
isLastQuestion: true,
22+
isResponding: true,
23+
questionIndex: 3,
24+
}),
25+
).toBe("Submitting...");
26+
});
27+
28+
it("returns 'Submit' in compact mode on the last question", () => {
29+
expect(
30+
formatPendingPrimaryActionLabel({
31+
compact: true,
32+
isLastQuestion: true,
33+
isResponding: false,
34+
questionIndex: 0,
35+
}),
36+
).toBe("Submit");
37+
});
38+
39+
it("returns 'Next' in compact mode when not the last question", () => {
40+
expect(
41+
formatPendingPrimaryActionLabel({
42+
compact: true,
43+
isLastQuestion: false,
44+
isResponding: false,
45+
questionIndex: 1,
46+
}),
47+
).toBe("Next");
48+
});
49+
50+
it("returns 'Next question' when not the last question", () => {
51+
expect(
52+
formatPendingPrimaryActionLabel({
53+
compact: false,
54+
isLastQuestion: false,
55+
isResponding: false,
56+
questionIndex: 0,
57+
}),
58+
).toBe("Next question");
59+
});
60+
61+
it("returns singular 'Submit answer' on the last question when it is the only question", () => {
62+
expect(
63+
formatPendingPrimaryActionLabel({
64+
compact: false,
65+
isLastQuestion: true,
66+
isResponding: false,
67+
questionIndex: 0,
68+
}),
69+
).toBe("Submit answer");
70+
});
71+
72+
it("returns plural 'Submit answers' on the last question when there are multiple questions", () => {
73+
expect(
74+
formatPendingPrimaryActionLabel({
75+
compact: false,
76+
isLastQuestion: true,
77+
isResponding: false,
78+
questionIndex: 1,
79+
}),
80+
).toBe("Submit answers");
81+
});
82+
83+
it("returns plural 'Submit answers' for higher question indices", () => {
84+
expect(
85+
formatPendingPrimaryActionLabel({
86+
compact: false,
87+
isLastQuestion: true,
88+
isResponding: false,
89+
questionIndex: 5,
90+
}),
91+
).toBe("Submit answers");
92+
});
93+
});

apps/web/src/components/chat/ComposerPrimaryActions.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,22 @@ interface ComposerPrimaryActionsProps {
2727
onImplementPlanInNewThread: () => void;
2828
}
2929

30-
const formatPendingPrimaryActionLabel = (input: {
30+
export const formatPendingPrimaryActionLabel = (input: {
3131
compact: boolean;
3232
isLastQuestion: boolean;
3333
isResponding: boolean;
34+
questionIndex: number;
3435
}) => {
3536
if (input.isResponding) {
3637
return "Submitting...";
3738
}
3839
if (input.compact) {
3940
return input.isLastQuestion ? "Submit" : "Next";
4041
}
41-
return input.isLastQuestion ? "Submit answers" : "Next question";
42+
if (!input.isLastQuestion) {
43+
return "Next question";
44+
}
45+
return input.questionIndex > 0 ? "Submit answers" : "Submit answer";
4246
};
4347

4448
export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
@@ -95,6 +99,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
9599
compact,
96100
isLastQuestion: pendingAction.isLastQuestion,
97101
isResponding: pendingAction.isResponding,
102+
questionIndex: pendingAction.questionIndex,
98103
})}
99104
</Button>
100105
</div>

0 commit comments

Comments
 (0)