Skip to content

Commit 4712f0f

Browse files
authored
feat(prompt): add shell mode UI with cancel button, custom icon, and example placeholder (#24105)
1 parent 6c1268f commit 4712f0f

21 files changed

Lines changed: 40 additions & 29 deletions

File tree

packages/app/src/components/prompt-input.tsx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
270270
const buttonsSpring = useSpring(() => (store.mode === "normal" ? 1 : 0), { visualDuration: 0.2, bounce: 0 })
271271
const motion = (value: number) => ({
272272
opacity: value,
273-
transform: `scale(${0.95 + value * 0.05})`,
273+
transform: `scale(${0.98 + value * 0.02})`,
274274
filter: `blur(${(1 - value) * 2}px)`,
275275
"pointer-events": value > 0.5 ? ("auto" as const) : ("none" as const),
276276
})
@@ -345,7 +345,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
345345
promptPlaceholder({
346346
mode: store.mode,
347347
commentCount: commentCount(),
348-
example: suggest() ? language.t(EXAMPLES[store.placeholder]) : "",
348+
example: suggest() ? (store.mode === "shell" ? "git status" : language.t(EXAMPLES[store.placeholder])) : "",
349349
suggest: suggest(),
350350
t: (key, params) => language.t(key as Parameters<typeof language.t>[0], params as never),
351351
}),
@@ -1403,12 +1403,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
14031403
<IconButton
14041404
data-action="prompt-submit"
14051405
type="submit"
1406-
disabled={store.mode !== "normal" || (!working() && blank())}
1406+
disabled={!working() && blank()}
14071407
tabIndex={store.mode === "normal" ? undefined : -1}
1408-
icon={stopping() ? "stop" : "arrow-up"}
1408+
icon={stopping() ? "stop" : store.mode === "shell" ? "arrow-undo-down" : "arrow-up"}
14091409
variant="primary"
14101410
class="size-8"
1411-
style={buttons()}
14121411
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
14131412
/>
14141413
</Tooltip>
@@ -1451,14 +1450,24 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
14511450
<div class="px-1.75 pt-5.5 pb-2 flex items-center gap-2 min-w-0">
14521451
<div class="flex items-center gap-1.5 min-w-0 flex-1 relative">
14531452
<div
1454-
class="h-7 flex items-center gap-1.5 max-w-[160px] min-w-0 absolute inset-y-0 left-0"
1453+
class="h-7 flex items-center gap-1.5 min-w-0 absolute inset-0"
14551454
style={{
1456-
padding: "0 4px 0 8px",
1455+
padding: "0 0px 0 8px",
14571456
...shell(),
14581457
}}
14591458
>
1460-
<span class="truncate text-13-medium text-text-strong">{language.t("prompt.mode.shell")}</span>
1461-
<div class="size-4 shrink-0" />
1459+
<Icon name="console" />
1460+
<span class="truncate text-13-medium text-text-base">{language.t("prompt.mode.shell")}</span>
1461+
<div class="flex-1" />
1462+
<Button
1463+
variant="ghost"
1464+
class="text-text-base"
1465+
onClick={() => {
1466+
setStore("mode", "normal")
1467+
}}
1468+
>
1469+
{language.t("common.cancel")}
1470+
</Button>
14621471
</div>
14631472
<div class="flex items-center gap-1.5 min-w-0 flex-1 h-7">
14641473
<Show when={!agentsLoading()}>

packages/app/src/components/prompt-input/placeholder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type PromptPlaceholderInput = {
77
}
88

99
export function promptPlaceholder(input: PromptPlaceholderInput) {
10-
if (input.mode === "shell") return input.t("prompt.placeholder.shell")
10+
if (input.mode === "shell") return input.t("prompt.placeholder.shell", { example: input.example })
1111
if (input.commentCount > 1) return input.t("prompt.placeholder.summarizeComments")
1212
if (input.commentCount === 1) return input.t("prompt.placeholder.summarizeComment")
1313
if (!input.suggest) return input.t("prompt.placeholder.simple")

packages/app/src/i18n/ar.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const dict = {
210210
"common.saving": "جارٍ الحفظ...",
211211
"common.default": "افتراضي",
212212
"common.attachment": "مرفق",
213-
"prompt.placeholder.shell": "أدخل أمر shell...",
213+
"prompt.placeholder.shell": "أدخل أمر shell... {{example}}",
214214
"prompt.placeholder.normal": 'اسأل أي شيء... "{{example}}"',
215215
"prompt.placeholder.simple": "اسأل أي شيء...",
216216
"prompt.placeholder.summarizeComments": "لخّص التعليقات…",

packages/app/src/i18n/br.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const dict = {
210210
"common.saving": "Salvando...",
211211
"common.default": "Padrão",
212212
"common.attachment": "anexo",
213-
"prompt.placeholder.shell": "Digite comando do shell...",
213+
"prompt.placeholder.shell": "Digite comando do shell... {{example}}",
214214
"prompt.placeholder.normal": 'Pergunte qualquer coisa... "{{example}}"',
215215
"prompt.placeholder.simple": "Pergunte qualquer coisa...",
216216
"prompt.placeholder.summarizeComments": "Resumir comentários…",

packages/app/src/i18n/bs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export const dict = {
228228
"common.default": "Podrazumijevano",
229229
"common.attachment": "prilog",
230230

231-
"prompt.placeholder.shell": "Unesi shell naredbu...",
231+
"prompt.placeholder.shell": "Unesi shell naredbu... {{example}}",
232232
"prompt.placeholder.normal": 'Pitaj bilo šta... "{{example}}"',
233233
"prompt.placeholder.simple": "Pitaj bilo šta...",
234234
"prompt.placeholder.summarizeComments": "Sažmi komentare…",

packages/app/src/i18n/da.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const dict = {
226226
"common.default": "Standard",
227227
"common.attachment": "vedhæftning",
228228

229-
"prompt.placeholder.shell": "Indtast shell-kommando...",
229+
"prompt.placeholder.shell": "Indtast shell-kommando... {{example}}",
230230
"prompt.placeholder.normal": 'Spørg om hvad som helst... "{{example}}"',
231231
"prompt.placeholder.simple": "Spørg om hvad som helst...",
232232
"prompt.placeholder.summarizeComments": "Opsummér kommentarer…",

packages/app/src/i18n/de.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ export const dict = {
215215
"common.saving": "Speichert...",
216216
"common.default": "Standard",
217217
"common.attachment": "Anhang",
218-
"prompt.placeholder.shell": "Shell-Befehl eingeben...",
218+
"prompt.placeholder.shell": "Shell-Befehl eingeben... {{example}}",
219219
"prompt.placeholder.normal": 'Fragen Sie alles... "{{example}}"',
220220
"prompt.placeholder.simple": "Fragen Sie alles...",
221221
"prompt.placeholder.summarizeComments": "Kommentare zusammenfassen…",

packages/app/src/i18n/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ export const dict = {
230230
"common.default": "Default",
231231
"common.attachment": "attachment",
232232

233-
"prompt.placeholder.shell": "Enter shell command...",
233+
"prompt.placeholder.shell": "Enter shell command... {{example}}",
234234
"prompt.placeholder.normal": 'Ask anything... "{{example}}"',
235235
"prompt.placeholder.simple": "Ask anything...",
236236
"prompt.placeholder.summarizeComments": "Summarize comments…",

packages/app/src/i18n/es.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export const dict = {
227227
"common.default": "Predeterminado",
228228
"common.attachment": "adjunto",
229229

230-
"prompt.placeholder.shell": "Introduce comando de shell...",
230+
"prompt.placeholder.shell": "Introduce comando de shell... {{example}}",
231231
"prompt.placeholder.normal": 'Pregunta cualquier cosa... "{{example}}"',
232232
"prompt.placeholder.simple": "Pregunta cualquier cosa...",
233233
"prompt.placeholder.summarizeComments": "Resumir comentarios…",

packages/app/src/i18n/fr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ export const dict = {
210210
"common.saving": "Enregistrement...",
211211
"common.default": "Défaut",
212212
"common.attachment": "pièce jointe",
213-
"prompt.placeholder.shell": "Entrez une commande shell...",
213+
"prompt.placeholder.shell": "Entrez une commande shell... {{example}}",
214214
"prompt.placeholder.normal": 'Demandez n\'importe quoi... "{{example}}"',
215215
"prompt.placeholder.simple": "Demandez n'importe quoi...",
216216
"prompt.placeholder.summarizeComments": "Résumer les commentaires…",

0 commit comments

Comments
 (0)