opencode-session-bar 1.1.2 → 1.1.3
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 +13 -6
- 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
|
|
@@ -33,7 +33,9 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<box>
|
|
36
|
-
<text fg={theme().text}>
|
|
36
|
+
<text fg={theme().text}>
|
|
37
|
+
<strong>Latest sessions</strong>
|
|
38
|
+
</text>
|
|
37
39
|
<Show when={sessions.loading}>
|
|
38
40
|
<text fg={theme().textMuted}>loading...</text>
|
|
39
41
|
</Show>
|
|
@@ -41,15 +43,20 @@ function View(props: { api: TuiPluginApi; sessionID: string }) {
|
|
|
41
43
|
<For each={sorted()}>
|
|
42
44
|
{(session) => {
|
|
43
45
|
const isDeleting = deleting().has(session.id)
|
|
44
|
-
|
|
46
|
+
onMount(() => {
|
|
47
|
+
const unsub1 = props.api.event.on("session.updated", () => refetch())
|
|
48
|
+
const unsub2 = props.api.event.on("session.deleted", () => refetch())
|
|
49
|
+
const unsub3 = props.api.event.on("session.created", () => refetch())
|
|
50
|
+
onCleanup(() => { unsub1(); unsub2(); unsub3() })
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
return (
|
|
45
54
|
<box flexDirection="row" justifyContent="space-between" overflow="hidden">
|
|
46
55
|
<text
|
|
47
56
|
fg={theme().textMuted}
|
|
48
57
|
flexGrow={1}
|
|
49
|
-
wrapMode="char"
|
|
50
|
-
truncate
|
|
51
58
|
>
|
|
52
|
-
{session.title}
|
|
59
|
+
{session.title.slice(0, 30)}
|
|
53
60
|
</text>
|
|
54
61
|
<Show when={!isDeleting}>
|
|
55
62
|
<text
|