blob: 29d9ac81e0de362971de1c57891ebafb6989c8f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
import { UserMessage } from "@opencode-ai/sdk"
import { ComponentProps, Show, splitProps } from "solid-js"
import { MessageNav } from "./message-nav"
import "./session-message-rail.css"
export interface SessionMessageRailProps extends ComponentProps<"div"> {
messages: UserMessage[]
current?: UserMessage
working?: boolean
wide?: boolean
onMessageSelect: (message: UserMessage) => void
}
export function SessionMessageRail(props: SessionMessageRailProps) {
const [local, others] = splitProps(props, [
"messages",
"current",
"working",
"wide",
"onMessageSelect",
"class",
"classList",
])
return (
<Show when={(local.messages?.length ?? 0) > 1}>
<div
{...others}
data-component="session-message-rail"
data-wide={local.wide ? "" : undefined}
classList={{
...(local.classList ?? {}),
[local.class ?? ""]: !!local.class,
}}
>
<div data-slot="session-message-rail-compact">
<MessageNav
messages={local.messages}
current={local.current}
onMessageSelect={local.onMessageSelect}
size="compact"
working={local.working}
/>
</div>
<div data-slot="session-message-rail-full">
<MessageNav
messages={local.messages}
current={local.current}
onMessageSelect={local.onMessageSelect}
size={local.wide ? "normal" : "compact"}
working={local.working}
/>
</div>
</div>
</Show>
)
}
|