wip(desktop): progress

This commit is contained in:
Adam 2025-12-15 06:06:05 -06:00
parent c0d009d5f3
commit 315836c0b7
No known key found for this signature in database
GPG key ID: 9CB48779AF150E75
2 changed files with 29 additions and 41 deletions

View file

@ -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)}

View file

@ -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,
)
@ -134,6 +113,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",
@ -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",