tui: simplify interface with minimal Claude Code-style design
This commit is contained in:
@@ -86,6 +86,21 @@ const setSessionHandoff = (key: string, patch: Partial<HandoffSession>) => {
|
||||
touch(handoff.session, key, { ...prev, ...patch })
|
||||
}
|
||||
|
||||
const readPromptParam = () => {
|
||||
if (typeof window === "undefined") return
|
||||
const value = new URLSearchParams(window.location.search).get("prompt")?.trim()
|
||||
if (!value) return
|
||||
return value
|
||||
}
|
||||
|
||||
const clearPromptParam = () => {
|
||||
if (typeof window === "undefined") return
|
||||
const url = new URL(window.location.href)
|
||||
if (!url.searchParams.has("prompt")) return
|
||||
url.searchParams.delete("prompt")
|
||||
window.history.replaceState({}, "", url)
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
const layout = useLayout()
|
||||
const local = useLocal()
|
||||
@@ -1491,6 +1506,20 @@ export default function Page() {
|
||||
setSessionHandoff(sessionKey(), { prompt: previewPrompt() })
|
||||
})
|
||||
|
||||
createEffect(
|
||||
on(
|
||||
() => [params.dir, params.id, prompt.ready()] as const,
|
||||
() => {
|
||||
if (!prompt.ready()) return
|
||||
const value = readPromptParam()
|
||||
if (!value) return
|
||||
clearPromptParam()
|
||||
if (prompt.dirty()) return
|
||||
prompt.set([{ type: "text", content: value, start: 0, end: value.length }], value.length)
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
createEffect(() => {
|
||||
if (!terminal.ready()) return
|
||||
language.locale()
|
||||
|
||||
Reference in New Issue
Block a user