|
|
@@ -1,7 +1,6 @@
|
|
|
import { UserMessage } from "@opencode-ai/sdk/v2"
|
|
|
-import { ComponentProps, createMemo, For, Match, Show, splitProps, Switch } from "solid-js"
|
|
|
+import { ComponentProps, For, Match, Show, splitProps, Switch } from "solid-js"
|
|
|
import { DiffChanges } from "./diff-changes"
|
|
|
-import { Spinner } from "./spinner"
|
|
|
import { Tooltip } from "@kobalte/core/tooltip"
|
|
|
|
|
|
export function MessageNav(
|
|
|
@@ -9,20 +8,15 @@ export function MessageNav(
|
|
|
messages: UserMessage[]
|
|
|
current?: UserMessage
|
|
|
size: "normal" | "compact"
|
|
|
- working?: boolean
|
|
|
onMessageSelect: (message: UserMessage) => void
|
|
|
},
|
|
|
) {
|
|
|
- const [local, others] = splitProps(props, ["messages", "current", "size", "working", "onMessageSelect"])
|
|
|
- const lastUserMessage = createMemo(() => {
|
|
|
- return local.messages?.at(-1)
|
|
|
- })
|
|
|
+ const [local, others] = splitProps(props, ["messages", "current", "size", "onMessageSelect"])
|
|
|
|
|
|
const content = () => (
|
|
|
<ul role="list" data-component="message-nav" data-size={local.size} {...others}>
|
|
|
<For each={local.messages}>
|
|
|
{(message) => {
|
|
|
- const messageWorking = createMemo(() => message.id === lastUserMessage()?.id && local.working)
|
|
|
const handleClick = () => local.onMessageSelect(message)
|
|
|
|
|
|
return (
|
|
|
@@ -35,14 +29,7 @@ export function MessageNav(
|
|
|
</Match>
|
|
|
<Match when={local.size === "normal"}>
|
|
|
<button data-slot="message-nav-message-button" onClick={handleClick}>
|
|
|
- <Switch>
|
|
|
- <Match when={messageWorking()}>
|
|
|
- <Spinner />
|
|
|
- </Match>
|
|
|
- <Match when={true}>
|
|
|
- <DiffChanges changes={message.summary?.diffs ?? []} variant="bars" />
|
|
|
- </Match>
|
|
|
- </Switch>
|
|
|
+ <DiffChanges changes={message.summary?.diffs ?? []} variant="bars" />
|
|
|
<div
|
|
|
data-slot="message-nav-title-preview"
|
|
|
data-active={message.id === local.current?.id || undefined}
|