Skip to content

Commit 7d0f79d

Browse files
authored
feat(app): make redesigned question dock opt-in (#59723)
1 parent 1341387 commit 7d0f79d

22 files changed

Lines changed: 4464 additions & 2901 deletions

‎packages/app/component-tests/session-question-dock.spec.ts‎

Lines changed: 1306 additions & 1141 deletions
Large diffs are not rendered by default.

‎packages/app/src/runtime/i18n/en.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,8 @@ export const dict = {
786786
"settings.experimental.row.newIcons.description": "Preview the updated icon set",
787787
"settings.experimental.row.foldUserMessages.title": "Fold long messages",
788788
"settings.experimental.row.foldUserMessages.description": "Fold your messages past 12 lines behind a Read more button",
789+
"settings.experimental.row.newQuestionUI.title": "New question UI",
790+
"settings.experimental.row.newQuestionUI.description": "Preview the keyboard-first question dock",
789791
"settings.plugins.reload": "Reload",
790792
"settings.plugins.status.loading": "Loading",
791793
"settings.plugins.status.failed": "Failed",

‎packages/app/src/session/composer/session-composer-region.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SessionElicitationDock } from "@/session/requests/session-elicitation-d
33
import { SessionPermissionDock } from "@/session/requests/session-permission-dock"
44
import { SessionQuestionDock } from "@/session/requests/session-question-dock"
55
import { questionMotion } from "@/session/requests/question-motion"
6+
import { useSettings } from "@/settings/model"
67
import { SessionWebSearchDock } from "@/session/requests/session-websearch-dock"
78
import type { SessionComposerRegionController } from "./session-composer-region-controller"
89
import { ComposerMorph, Grow } from "./spring-height"
@@ -30,6 +31,7 @@ export function SessionComposerRegion(props: {
3031
subagent: JSX.Element
3132
}) {
3233
const controller = props.controller
34+
const settings = useSettings()
3335

3436
const face = createMemo(() => {
3537
const websearch = controller.state.websearch.request()
@@ -56,15 +58,18 @@ export function SessionComposerRegion(props: {
5658
>
5759
<div class="relative z-[70] flex flex-col">
5860
{props.above}
59-
<ComposerMorph face={face()} instant={(face) => !!face.question && !questionMotion()}>
61+
<ComposerMorph
62+
face={face()}
63+
instant={(face) => !!face.question && (!settings.general.newQuestionUI() || !questionMotion())}
64+
>
6065
{(current) => (
6166
<div class="flex flex-col">
6267
<Grow when={current().websearch} fade card class={controller.child() ? "mb-2" : undefined}>
6368
<SessionWebSearchDock model={controller.state.websearch} onSubmit={controller.onResponseSubmit} />
6469
</Grow>
6570
<Grow
6671
when={current().question}
67-
instant={!questionMotion()}
72+
instant={!settings.general.newQuestionUI() || !questionMotion()}
6873
fade
6974
card
7075
class={controller.child() ? "mb-2" : undefined}

‎packages/app/src/session/question-switch.stories.tsx‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { activeQuestionRequest, questionPendingDocument } from "@opencode/session-ui/storybook"
22
import { SessionPreview } from "./story-model"
3+
import { SettingsExperimental } from "@/settings/experimental/experimental"
34

45
export default {
56
title: "OpenCode/Session/Question switch",
@@ -12,13 +13,25 @@ export default {
1213
docs: {
1314
description: {
1415
component:
15-
"A pending question dock with five questions of different heights. Step through them with ← and →, or the Replay buttons under Knobs → Timeline → Question. Its motion is off until Question dock motion is turned on there.",
16+
"Compare the original question cards with the New question UI experiment. With the experiment enabled, step through questions with ← and →. Its motion is off until Question dock motion is turned on under Knobs → Timeline → Question.",
1617
},
1718
},
1819
},
1920
}
2021

21-
// Several questions of different lengths and kinds in a row, to step through with ← and →.
22+
export const Experiments = {
23+
render: () => (
24+
<SessionPreview
25+
title="Choose a Session layout"
26+
description="opencode · question UI experiments"
27+
document={questionPendingDocument}
28+
request={{ type: "question", value: activeQuestionRequest }}
29+
side={<SettingsExperimental />}
30+
/>
31+
),
32+
}
33+
34+
// Several questions of different lengths and kinds in a row.
2235
export const QuestionSeries = {
2336
render: () => (
2437
<SessionPreview
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export const questionCache = new Map<
2+
string,
3+
{ tab: number; answers: string[][]; custom: string[]; customOn: boolean[] }
4+
>()

0 commit comments

Comments
 (0)