Explorar o código

tui: position prompt at bottom when resuming from handoff with initial prompt

Dax Raad hai 2 meses
pai
achega
246430cb8f
Modificáronse 1 ficheiros con 24 adicións e 11 borrados
  1. 24 11
      packages/opencode/src/cli/cmd/tui/routes/home.tsx

+ 24 - 11
packages/opencode/src/cli/cmd/tui/routes/home.tsx

@@ -77,11 +77,11 @@ export function Home() {
   let prompt: PromptRef
   const args = useArgs()
   onMount(() => {
-    if (once) return
     if (route.initialPrompt) {
       prompt.set(route.initialPrompt)
-      once = true
-    } else if (args.prompt) {
+      return
+    }
+    if (!once && args.prompt) {
       prompt.set({ input: args.prompt, parts: [] })
       once = true
       prompt.submit()
@@ -96,7 +96,26 @@ export function Home() {
       <box flexGrow={1} justifyContent="center" alignItems="center" paddingLeft={2} paddingRight={2} gap={1}>
         <box height={3} />
         <Logo />
-        <box width="100%" maxWidth={75} zIndex={1000} paddingTop={1}>
+        <Show when={!route.initialPrompt}>
+          <box width="100%" maxWidth={75} zIndex={1000} paddingTop={1}>
+            <Prompt
+              ref={(r) => {
+                prompt = r
+                promptRef.set(r)
+              }}
+              hint={Hint}
+            />
+          </box>
+        </Show>
+        <box height={3} width="100%" maxWidth={75} alignItems="center" paddingTop={2}>
+          <Show when={showTips()}>
+            <Tips />
+          </Show>
+        </box>
+        <Toast />
+      </box>
+      <Show when={route.initialPrompt}>
+        <box paddingLeft={2} paddingRight={2}>
           <Prompt
             ref={(r) => {
               prompt = r
@@ -105,13 +124,7 @@ export function Home() {
             hint={Hint}
           />
         </box>
-        <box height={3} width="100%" maxWidth={75} alignItems="center" paddingTop={2}>
-          <Show when={showTips()}>
-            <Tips />
-          </Show>
-        </box>
-        <Toast />
-      </box>
+      </Show>
       <box paddingTop={1} paddingBottom={1} paddingLeft={2} paddingRight={2} flexDirection="row" flexShrink={0} gap={2}>
         <text fg={theme.textMuted}>{directory()}</text>
         <box gap={1} flexDirection="row" flexShrink={0}>