Skip to content

Commit dbbe931

Browse files
authored
fix(app): avoid prompt tooltip Switch on startup (anomalyco#17857)
1 parent e14e874 commit dbbe931

1 file changed

Lines changed: 19 additions & 17 deletions

File tree

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

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { useFilteredList } from "@opencode-ai/ui/hooks"
22
import { useSpring } from "@opencode-ai/ui/motion-spring"
3-
import { createEffect, on, Component, Show, onCleanup, Switch, Match, createMemo, createSignal } from "solid-js"
3+
import { createEffect, on, Component, Show, onCleanup, createMemo, createSignal } from "solid-js"
44
import { createStore } from "solid-js/store"
55
import { useLocal } from "@/context/local"
66
import { selectionFromLines, type SelectedLineRange, useFile } from "@/context/file"
@@ -244,6 +244,23 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
244244
},
245245
)
246246
const working = createMemo(() => status()?.type !== "idle")
247+
const tip = () => {
248+
if (working()) {
249+
return (
250+
<div class="flex items-center gap-2">
251+
<span>{language.t("prompt.action.stop")}</span>
252+
<span class="text-icon-base text-12-medium text-[10px]!">{language.t("common.key.esc")}</span>
253+
</div>
254+
)
255+
}
256+
257+
return (
258+
<div class="flex items-center gap-2">
259+
<span>{language.t("prompt.action.send")}</span>
260+
<Icon name="enter" size="small" class="text-icon-base" />
261+
</div>
262+
)
263+
}
247264
const imageAttachments = createMemo(() =>
248265
prompt.current().filter((part): part is ImageAttachmentPart => part.type === "image"),
249266
)
@@ -1365,22 +1382,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
13651382
<Tooltip
13661383
placement="top"
13671384
inactive={!prompt.dirty() && !working()}
1368-
value={
1369-
<Switch>
1370-
<Match when={working()}>
1371-
<div class="flex items-center gap-2">
1372-
<span>{language.t("prompt.action.stop")}</span>
1373-
<span class="text-icon-base text-12-medium text-[10px]!">{language.t("common.key.esc")}</span>
1374-
</div>
1375-
</Match>
1376-
<Match when={true}>
1377-
<div class="flex items-center gap-2">
1378-
<span>{language.t("prompt.action.send")}</span>
1379-
<Icon name="enter" size="small" class="text-icon-base" />
1380-
</div>
1381-
</Match>
1382-
</Switch>
1383-
}
1385+
value={tip()}
13841386
>
13851387
<IconButton
13861388
data-action="prompt-submit"

0 commit comments

Comments
 (0)