opencode-session-bar 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.tsx +11 -5
- package/package.json +1 -1
package/index.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsxImportSource @opentui/solid */
|
|
2
2
|
import type { TuiPlugin, TuiPluginApi, TuiPluginModule } from "@opencode-ai/plugin/tui";
|
|
3
|
-
import { createResource, createSignal, For, Show } from "solid-js";
|
|
3
|
+
import { createResource, createSignal, For, onCleanup, onMount, Show } from "solid-js";
|
|
4
4
|
|
|
5
5
|
function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
6
6
|
const theme = () => props.api.theme.current
|
|
@@ -30,10 +30,18 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
30
30
|
setDeleting(prev => { const next = new Set(prev); next.delete(id); return next })
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
+
onMount(() => {
|
|
34
|
+
const unsub1 = props.api.event.on("session.updated", () => refetch())
|
|
35
|
+
const unsub2 = props.api.event.on("session.deleted", () => refetch())
|
|
36
|
+
const unsub3 = props.api.event.on("session.created", () => refetch())
|
|
37
|
+
onCleanup(() => { unsub1(); unsub2(); unsub3() })
|
|
38
|
+
})
|
|
33
39
|
|
|
34
40
|
return (
|
|
35
41
|
<box>
|
|
36
|
-
<text fg={theme().text}>
|
|
42
|
+
<text fg={theme().text}>
|
|
43
|
+
<strong>Latest sessions</strong>
|
|
44
|
+
</text>
|
|
37
45
|
<Show when={sessions.loading}>
|
|
38
46
|
<text fg={theme().textMuted}>loading...</text>
|
|
39
47
|
</Show>
|
|
@@ -46,10 +54,8 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
46
54
|
<text
|
|
47
55
|
fg={theme().textMuted}
|
|
48
56
|
flexGrow={1}
|
|
49
|
-
wrapMode="char"
|
|
50
|
-
truncate
|
|
51
57
|
>
|
|
52
|
-
{session.title}
|
|
58
|
+
{session.title.slice(0, 30)}
|
|
53
59
|
</text>
|
|
54
60
|
<Show when={!isDeleting}>
|
|
55
61
|
<text
|