diff options
| author | Adam <[email protected]> | 2025-12-15 06:06:05 -0600 |
|---|---|---|
| committer | Adam <[email protected]> | 2025-12-15 10:20:18 -0600 |
| commit | 315836c0b7f7f852c99d8c9945fa15e63a3ea2bc (patch) | |
| tree | a817c3d791234dc791c2fe29610bc4287a0f2d3c /packages/desktop/src | |
| parent | c0d009d5f33c368f61ebe9a87460b1fbf5801d33 (diff) | |
| download | opencode-315836c0b7f7f852c99d8c9945fa15e63a3ea2bc.tar.gz opencode-315836c0b7f7f852c99d8c9945fa15e63a3ea2bc.zip | |
wip(desktop): progress
Diffstat (limited to 'packages/desktop/src')
| -rw-r--r-- | packages/desktop/src/components/prompt-input.tsx | 6 | ||||
| -rw-r--r-- | packages/desktop/src/pages/session.tsx | 64 |
2 files changed, 29 insertions, 41 deletions
diff --git a/packages/desktop/src/components/prompt-input.tsx b/packages/desktop/src/components/prompt-input.tsx index fd5574990..4dd8d878c 100644 --- a/packages/desktop/src/components/prompt-input.tsx +++ b/packages/desktop/src/components/prompt-input.tsx @@ -591,8 +591,8 @@ export const PromptInput: Component<PromptInputProps> = (props) => { {/* Popover for file mentions and slash commands */} <Show when={store.popover}> <div - class="absolute inset-x-0 -top-3 -translate-y-full origin-bottom-left max-h-[252px] min-h-10 - overflow-auto no-scrollbar flex flex-col p-2 pb-0 rounded-md + class="absolute inset-x-0 -top-3 -translate-y-full origin-bottom-left max-h-80 min-h-10 + overflow-auto no-scrollbar flex flex-col p-2 rounded-md border border-border-base bg-surface-raised-stronger-non-alpha shadow-md" > <Switch> @@ -602,7 +602,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => { {(i) => ( <button classList={{ - "w-full flex items-center gap-x-2 rounded-md px-2 py-1": true, + "w-full flex items-center gap-x-2 rounded-md px-2 py-0.5": true, "bg-surface-raised-base-hover": active() === i, }} onClick={() => handleFileSelect(i)} diff --git a/packages/desktop/src/pages/session.tsx b/packages/desktop/src/pages/session.tsx index 66a2fcec7..5c74f2d2e 100644 --- a/packages/desktop/src/pages/session.tsx +++ b/packages/desktop/src/pages/session.tsx @@ -29,15 +29,13 @@ import type { JSX } from "solid-js" import { useSync } from "@/context/sync" import { useTerminal, type LocalPTY } from "@/context/terminal" import { useLayout } from "@/context/layout" -import { usePrompt } from "@/context/prompt" import { getDirectory, getFilename } from "@opencode-ai/util/path" import { Terminal } from "@/components/terminal" import { checksum } from "@opencode-ai/util/encode" import { useDialog } from "@opencode-ai/ui/context/dialog" import { DialogSelectFile } from "@/components/dialog-select-file" import { useCommand } from "@/context/command" -import { useParams } from "@solidjs/router" -import { pipe, sumBy } from "remeda" +import { useNavigate, useParams } from "@solidjs/router" import { AssistantMessage, UserMessage } from "@opencode-ai/sdk/v2" export default function Page() { @@ -45,10 +43,10 @@ export default function Page() { const local = useLocal() const sync = useSync() const terminal = useTerminal() - const prompt = usePrompt() const dialog = useDialog() const command = useCommand() const params = useParams() + const navigate = useNavigate() // Session-specific derived state const sessionKey = createMemo(() => `${params.dir}${params.id ? "/" + params.id : ""}`) @@ -72,25 +70,6 @@ export default function Page() { setMessageStore("messageId", message?.id) } - const status = createMemo( - () => - sync.data.session_status[params.id ?? ""] ?? { - type: "idle", - }, - ) - const working = createMemo(() => status()?.type !== "idle") - - const cost = createMemo(() => { - const total = pipe( - messages(), - sumBy((x) => (x.role === "assistant" ? x.cost : 0)), - ) - return new Intl.NumberFormat("en-US", { - style: "currency", - currency: "USD", - }).format(total) - }) - const last = createMemo( () => messages().findLast((x) => x.role === "assistant" && x.tokens.output > 0) as AssistantMessage, ) @@ -135,6 +114,15 @@ export default function Page() { // Register commands for this page command.register(() => [ { + id: "session.new", + title: "New session", + description: "Create a new session", + category: "Session", + keybind: "mod+n", + slash: "new", + onSelect: () => navigate(`/${params.dir}/session`), + }, + { id: "file.open", title: "Open file", description: "Search and open a file", @@ -143,21 +131,21 @@ export default function Page() { slash: "open", onSelect: () => dialog.replace(() => <DialogSelectFile />), }, - { - id: "theme.toggle", - title: "Toggle theme", - description: "Switch between themes", - category: "View", - keybind: "ctrl+t", - slash: "theme", - onSelect: () => { - const currentTheme = localStorage.getItem("theme") ?? "oc-1" - const themes = ["oc-1", "oc-2-paper"] - const nextTheme = themes[(themes.indexOf(currentTheme) + 1) % themes.length] - localStorage.setItem("theme", nextTheme) - document.documentElement.setAttribute("data-theme", nextTheme) - }, - }, + // { + // id: "theme.toggle", + // title: "Toggle theme", + // description: "Switch between themes", + // category: "View", + // keybind: "ctrl+t", + // slash: "theme", + // onSelect: () => { + // const currentTheme = localStorage.getItem("theme") ?? "oc-1" + // const themes = ["oc-1", "oc-2-paper"] + // const nextTheme = themes[(themes.indexOf(currentTheme) + 1) % themes.length] + // localStorage.setItem("theme", nextTheme) + // document.documentElement.setAttribute("data-theme", nextTheme) + // }, + // }, { id: "terminal.toggle", title: "Toggle terminal", |
