diff options
| author | Brendan Allan <[email protected]> | 2026-04-24 14:04:55 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-24 14:04:55 +0800 |
| commit | 4712f0f3c185fc3a348e2609689130fd2d901954 (patch) | |
| tree | 7a05f5b581360ff959a6eb32708db2f81b80ddca /packages/app/src/components | |
| parent | 6c1268f3b18ed289bc524ed10add8c3caa6131d2 (diff) | |
| download | opencode-4712f0f3c185fc3a348e2609689130fd2d901954.tar.gz opencode-4712f0f3c185fc3a348e2609689130fd2d901954.zip | |
feat(prompt): add shell mode UI with cancel button, custom icon, and example placeholder (#24105)
Diffstat (limited to 'packages/app/src/components')
| -rw-r--r-- | packages/app/src/components/prompt-input.tsx | 27 | ||||
| -rw-r--r-- | packages/app/src/components/prompt-input/placeholder.ts | 2 |
2 files changed, 19 insertions, 10 deletions
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx index 06c91c292..8b69f3b2a 100644 --- a/packages/app/src/components/prompt-input.tsx +++ b/packages/app/src/components/prompt-input.tsx @@ -270,7 +270,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { const buttonsSpring = useSpring(() => (store.mode === "normal" ? 1 : 0), { visualDuration: 0.2, bounce: 0 }) const motion = (value: number) => ({ opacity: value, - transform: `scale(${0.95 + value * 0.05})`, + transform: `scale(${0.98 + value * 0.02})`, filter: `blur(${(1 - value) * 2}px)`, "pointer-events": value > 0.5 ? ("auto" as const) : ("none" as const), }) @@ -345,7 +345,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { promptPlaceholder({ mode: store.mode, commentCount: commentCount(), - example: suggest() ? language.t(EXAMPLES[store.placeholder]) : "", + example: suggest() ? (store.mode === "shell" ? "git status" : language.t(EXAMPLES[store.placeholder])) : "", suggest: suggest(), t: (key, params) => language.t(key as Parameters<typeof language.t>[0], params as never), }), @@ -1403,12 +1403,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => { <IconButton data-action="prompt-submit" type="submit" - disabled={store.mode !== "normal" || (!working() && blank())} + disabled={!working() && blank()} tabIndex={store.mode === "normal" ? undefined : -1} - icon={stopping() ? "stop" : "arrow-up"} + icon={stopping() ? "stop" : store.mode === "shell" ? "arrow-undo-down" : "arrow-up"} variant="primary" class="size-8" - style={buttons()} aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")} /> </Tooltip> @@ -1451,14 +1450,24 @@ export const PromptInput: Component<PromptInputProps> = (props) => { <div class="px-1.75 pt-5.5 pb-2 flex items-center gap-2 min-w-0"> <div class="flex items-center gap-1.5 min-w-0 flex-1 relative"> <div - class="h-7 flex items-center gap-1.5 max-w-[160px] min-w-0 absolute inset-y-0 left-0" + class="h-7 flex items-center gap-1.5 min-w-0 absolute inset-0" style={{ - padding: "0 4px 0 8px", + padding: "0 0px 0 8px", ...shell(), }} > - <span class="truncate text-13-medium text-text-strong">{language.t("prompt.mode.shell")}</span> - <div class="size-4 shrink-0" /> + <Icon name="console" /> + <span class="truncate text-13-medium text-text-base">{language.t("prompt.mode.shell")}</span> + <div class="flex-1" /> + <Button + variant="ghost" + class="text-text-base" + onClick={() => { + setStore("mode", "normal") + }} + > + {language.t("common.cancel")} + </Button> </div> <div class="flex items-center gap-1.5 min-w-0 flex-1 h-7"> <Show when={!agentsLoading()}> diff --git a/packages/app/src/components/prompt-input/placeholder.ts b/packages/app/src/components/prompt-input/placeholder.ts index 395fee51b..6669f1361 100644 --- a/packages/app/src/components/prompt-input/placeholder.ts +++ b/packages/app/src/components/prompt-input/placeholder.ts @@ -7,7 +7,7 @@ type PromptPlaceholderInput = { } export function promptPlaceholder(input: PromptPlaceholderInput) { - if (input.mode === "shell") return input.t("prompt.placeholder.shell") + if (input.mode === "shell") return input.t("prompt.placeholder.shell", { example: input.example }) if (input.commentCount > 1) return input.t("prompt.placeholder.summarizeComments") if (input.commentCount === 1) return input.t("prompt.placeholder.summarizeComment") if (!input.suggest) return input.t("prompt.placeholder.simple") |
