mux-sesh 1.5.0 → 1.6.0
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/package.json +1 -1
- package/src/app.tsx +606 -175
- package/src/components/KeybindHelp.tsx +156 -135
- package/src/config/index.ts +208 -2
- package/src/handlers/keyboard.ts +204 -34
- package/src/settings.ts +425 -0
- package/src/styles/opencode-themes-a.ts +1 -0
- package/src/styles/opencode-themes-b.ts +1 -0
- package/src/styles/theme.tsx +441 -0
- package/src/types/index.ts +65 -0
- package/src/ui/CommandsModal.tsx +145 -0
- package/src/ui/HighlightedText.tsx +6 -3
- package/src/ui/ItemList.tsx +34 -35
- package/src/ui/Modal.tsx +41 -0
- package/src/ui/OpencodeSessionGroup.tsx +26 -28
- package/src/ui/OpencodeStatsPanel.tsx +34 -39
- package/src/ui/RenameModal.tsx +42 -0
- package/src/ui/SearchInput.tsx +3 -1
- package/src/ui/SessionDetailsPanel.tsx +68 -106
- package/src/ui/SessionList.tsx +33 -42
- package/src/ui/SessionStats.tsx +5 -3
- package/src/ui/SettingEditorModal.tsx +49 -0
- package/src/ui/SettingOptionsModal.tsx +77 -0
- package/src/ui/SettingsModal.tsx +96 -0
- package/src/ui/Toast.tsx +8 -9
- package/src/ui/item-icon.ts +13 -12
- package/src/styles/theme.ts +0 -50
package/src/ui/ItemList.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTheme } from '../styles/theme'
|
|
2
2
|
import { AppMode, type IconConfig } from '../types'
|
|
3
3
|
import HighlightedText from './HighlightedText'
|
|
4
4
|
import { getItemIconPresentation } from './item-icon'
|
|
@@ -12,6 +12,7 @@ interface Props {
|
|
|
12
12
|
maxItems?: number
|
|
13
13
|
searchQuery?: string
|
|
14
14
|
icons?: IconConfig
|
|
15
|
+
pendingKillSessionName?: string | null
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
export default function ItemList({
|
|
@@ -21,7 +22,9 @@ export default function ItemList({
|
|
|
21
22
|
maxItems = 20,
|
|
22
23
|
searchQuery = '',
|
|
23
24
|
icons,
|
|
25
|
+
pendingKillSessionName,
|
|
24
26
|
}: Props) {
|
|
27
|
+
const theme = useTheme()
|
|
25
28
|
const isSearching = searchQuery.trim().length > 0
|
|
26
29
|
const visibleWindow = getVisibleWindow(items, cursor, maxItems)
|
|
27
30
|
|
|
@@ -33,65 +36,61 @@ export default function ItemList({
|
|
|
33
36
|
const descMatchIndices = item.searchMatch?.descIndices
|
|
34
37
|
const hasTitleMatch = titleMatchIndices && titleMatchIndices.length > 0
|
|
35
38
|
const hasDescMatch = descMatchIndices && descMatchIndices.length > 0
|
|
36
|
-
const icon = getItemIconPresentation(item, icons)
|
|
39
|
+
const icon = getItemIconPresentation(theme, item, icons)
|
|
37
40
|
const sessionStatusLabel = item.linkedSessionName ? 'attach' : 'create'
|
|
38
41
|
const linkedSessionLabel = item.linkedSessionName ? ` -> ${item.linkedSessionName}` : ''
|
|
42
|
+
const pendingKill = item.isSession && item.title === pendingKillSessionName
|
|
43
|
+
const selected = absoluteIndex === cursor
|
|
39
44
|
|
|
40
45
|
return (
|
|
41
46
|
<box
|
|
42
47
|
key={i}
|
|
43
48
|
style={{
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
flexDirection: 'row',
|
|
50
|
+
justifyContent: 'space-between',
|
|
51
|
+
backgroundColor: pendingKill ? theme.dangerSurface : selected ? theme.surfaceAlt : 'transparent',
|
|
52
|
+
paddingLeft: 1,
|
|
53
|
+
paddingRight: 1,
|
|
47
54
|
}}
|
|
48
55
|
>
|
|
49
|
-
{absoluteIndex === cursor && <text> </text>}
|
|
50
56
|
<text>
|
|
51
|
-
{
|
|
57
|
+
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>{selected ? '› ' : ' '}</span>
|
|
52
58
|
{item.isSession ? (
|
|
53
59
|
<>
|
|
54
|
-
<span style={{ fg: item.isAttached ?
|
|
55
|
-
{item.isAttached ? '●' : '○'}
|
|
56
|
-
</span>{' '}
|
|
60
|
+
<span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>{item.isAttached ? '●' : '○'}</span>{' '}
|
|
57
61
|
{isSearching && hasTitleMatch ? (
|
|
58
62
|
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
59
63
|
) : (
|
|
60
|
-
item.title
|
|
61
|
-
)}
|
|
62
|
-
<span style={{ fg: colors.inactive }}>({item.windowCount})</span>
|
|
64
|
+
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
65
|
+
)}
|
|
63
66
|
</>
|
|
64
67
|
) : (
|
|
65
68
|
<>
|
|
66
69
|
<span style={{ fg: icon.color }}>{icon.glyph}</span>{' '}
|
|
67
70
|
{appMode === AppMode.NewSession ? (
|
|
68
|
-
|
|
69
|
-
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
{linkedSessionLabel && <span style={{ fg: colors.separator }}>{linkedSessionLabel}</span>}
|
|
76
|
-
</>
|
|
71
|
+
isSearching && hasDescMatch ? (
|
|
72
|
+
<HighlightedText text={item.desc} matchIndices={descMatchIndices} />
|
|
73
|
+
) : (
|
|
74
|
+
<span style={{ fg: theme.text }}>{item.desc}</span>
|
|
75
|
+
)
|
|
76
|
+
) : isSearching && hasTitleMatch ? (
|
|
77
|
+
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
77
78
|
) : (
|
|
78
|
-
|
|
79
|
-
{isSearching && hasTitleMatch ? (
|
|
80
|
-
<HighlightedText text={item.title} matchIndices={titleMatchIndices} />
|
|
81
|
-
) : (
|
|
82
|
-
item.title
|
|
83
|
-
)}
|
|
84
|
-
{item.desc && (
|
|
85
|
-
<>
|
|
86
|
-
{' '}
|
|
87
|
-
<span style={{ fg: colors.inactive }}>{item.desc}</span>
|
|
88
|
-
</>
|
|
89
|
-
)}
|
|
90
|
-
</>
|
|
79
|
+
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
91
80
|
)}
|
|
92
81
|
</>
|
|
93
82
|
)}
|
|
94
83
|
</text>
|
|
84
|
+
|
|
85
|
+
<text style={{ fg: pendingKill ? theme.danger : theme.textSubtle }}>
|
|
86
|
+
{item.isSession
|
|
87
|
+
? pendingKill
|
|
88
|
+
? 'press d again to kill'
|
|
89
|
+
: `(${item.windowCount})`
|
|
90
|
+
: appMode === AppMode.NewSession
|
|
91
|
+
? `${sessionStatusLabel}${linkedSessionLabel}`
|
|
92
|
+
: item.desc ?? ''}
|
|
93
|
+
</text>
|
|
95
94
|
</box>
|
|
96
95
|
)
|
|
97
96
|
})}
|
package/src/ui/Modal.tsx
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ReactNode } from 'react'
|
|
2
|
+
import { RGBA } from '@opentui/core'
|
|
3
|
+
import { getModalStyle, useTheme } from '../styles/theme'
|
|
4
|
+
|
|
5
|
+
interface Props {
|
|
6
|
+
title: string
|
|
7
|
+
description?: string
|
|
8
|
+
footer?: string
|
|
9
|
+
columns: number
|
|
10
|
+
preferredWidth?: number
|
|
11
|
+
children: ReactNode
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function Modal({ title, description, footer, columns, preferredWidth, children }: Props) {
|
|
15
|
+
const theme = useTheme()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<box
|
|
19
|
+
style={{
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: 0,
|
|
22
|
+
left: 0,
|
|
23
|
+
width: '100%',
|
|
24
|
+
height: '100%',
|
|
25
|
+
justifyContent: 'center',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
backgroundColor: RGBA.fromInts(0, 0, 0, 150),
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<box style={getModalStyle(theme, columns, preferredWidth)}>
|
|
31
|
+
<box style={{ flexDirection: 'row', justifyContent: 'space-between' }}>
|
|
32
|
+
<text style={{ fg: theme.text }}>{title}</text>
|
|
33
|
+
<text style={{ fg: theme.textMuted }}>esc</text>
|
|
34
|
+
</box>
|
|
35
|
+
{description && <text style={{ fg: theme.textMuted, marginTop: 1 }}>{description}</text>}
|
|
36
|
+
<box style={{ flexDirection: 'column', marginTop: 1 }}>{children}</box>
|
|
37
|
+
{footer && <text style={{ fg: theme.textMuted, marginTop: 1 }}>{footer}</text>}
|
|
38
|
+
</box>
|
|
39
|
+
</box>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTheme } from '../styles/theme'
|
|
2
2
|
import { formatSessionAge } from '../util/time'
|
|
3
3
|
import type { IconConfig, Item, AppMode } from '../types'
|
|
4
4
|
import { AppMode as AppModeEnum } from '../types'
|
|
@@ -9,61 +9,59 @@ interface Props {
|
|
|
9
9
|
appMode: AppMode
|
|
10
10
|
cursor: number
|
|
11
11
|
icons?: IconConfig
|
|
12
|
+
pendingKillSessionName?: string | null
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
export default function OpencodeSessionGroup({ sessions, appMode, cursor, icons }: Props) {
|
|
15
|
+
export default function OpencodeSessionGroup({ sessions, appMode, cursor, icons, pendingKillSessionName }: Props) {
|
|
16
|
+
const theme = useTheme()
|
|
15
17
|
if (sessions.length === 0) return null
|
|
16
18
|
|
|
17
|
-
const header = formatSectionHeader('opencode', icons)
|
|
19
|
+
const header = formatSectionHeader(theme, 'opencode', icons)
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<>
|
|
21
|
-
<text style={{ fg:
|
|
23
|
+
<text style={{ fg: theme.textSubtle, marginTop: 2, marginBottom: 1 }}>
|
|
22
24
|
<span style={{ fg: header.color }}>{header.text}</span>
|
|
23
25
|
</text>
|
|
24
26
|
{sessions.map((item, i) => {
|
|
27
|
+
const pendingKill = item.title === pendingKillSessionName
|
|
28
|
+
const selected = appMode === AppModeEnum.OpencodeManage && i === cursor
|
|
29
|
+
|
|
25
30
|
return (
|
|
26
31
|
<box
|
|
27
32
|
key={`opencode-${i}`}
|
|
28
33
|
style={{
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
flexDirection: 'row',
|
|
35
|
+
justifyContent: 'space-between',
|
|
31
36
|
backgroundColor:
|
|
32
|
-
|
|
33
|
-
?
|
|
34
|
-
:
|
|
37
|
+
pendingKill
|
|
38
|
+
? theme.dangerSurface
|
|
39
|
+
: selected
|
|
40
|
+
? theme.surfaceAlt
|
|
41
|
+
: 'transparent',
|
|
42
|
+
paddingLeft: 1,
|
|
43
|
+
paddingRight: 1,
|
|
35
44
|
}}
|
|
36
45
|
>
|
|
37
|
-
{appMode === AppModeEnum.OpencodeManage && i === cursor && <text> </text>}
|
|
38
46
|
<text>
|
|
39
|
-
|
|
47
|
+
<span style={{ fg: selected ? theme.primary : theme.textSubtle }}>{selected ? '› ' : ' '}</span>
|
|
40
48
|
<span
|
|
41
49
|
style={{
|
|
42
|
-
fg:
|
|
43
|
-
appMode === AppModeEnum.OpencodeManage
|
|
44
|
-
? item.isAttached
|
|
45
|
-
? colors.active
|
|
46
|
-
: colors.inactive
|
|
47
|
-
: colors.inactive,
|
|
50
|
+
fg: item.isAttached ? theme.active : theme.inactive,
|
|
48
51
|
}}
|
|
49
52
|
>
|
|
50
53
|
{item.isAttached ? '●' : '○'}
|
|
51
54
|
</span>{' '}
|
|
52
|
-
<span
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{item.title.padEnd(20)}
|
|
58
|
-
</span>{' '}
|
|
59
|
-
<span style={{ fg: colors.inactive }}>
|
|
60
|
-
{item.createdAt ? formatSessionAge(item.createdAt) : ''}
|
|
61
|
-
</span>
|
|
55
|
+
<span style={{ fg: theme.text }}>{item.title}</span>
|
|
56
|
+
</text>
|
|
57
|
+
|
|
58
|
+
<text style={{ fg: pendingKill ? theme.danger : theme.textSubtle }}>
|
|
59
|
+
{pendingKill ? 'press d again to kill' : item.createdAt ? formatSessionAge(item.createdAt) : ''}
|
|
62
60
|
</text>
|
|
63
61
|
</box>
|
|
64
62
|
)
|
|
65
63
|
})}
|
|
66
|
-
<box style={{ marginBottom:
|
|
64
|
+
<box style={{ marginBottom: 1 }} />
|
|
67
65
|
</>
|
|
68
66
|
)
|
|
69
67
|
}
|
|
@@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'
|
|
|
2
2
|
import { formatSessionAge } from '../opencode'
|
|
3
3
|
import { getGlobalOpencodeStats } from '../opencode/parser'
|
|
4
4
|
import type { OpencodeStats } from '../opencode'
|
|
5
|
-
import {
|
|
5
|
+
import { getDetailPanelStyle, useTheme } from '../styles/theme'
|
|
6
6
|
import type { Item } from '../types'
|
|
7
7
|
|
|
8
8
|
interface Props {
|
|
@@ -19,6 +19,7 @@ function formatNumber(value: number): string {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
22
|
+
const theme = useTheme()
|
|
22
23
|
const [globalStatsState, setGlobalStatsState] = useState<GlobalStatsState>({ status: 'loading' })
|
|
23
24
|
|
|
24
25
|
useEffect(() => {
|
|
@@ -59,7 +60,7 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
59
60
|
const sessionCost = sessionStats?.sessionTotalCost ?? 0
|
|
60
61
|
|
|
61
62
|
const panelStyle = {
|
|
62
|
-
...
|
|
63
|
+
...getDetailPanelStyle(theme),
|
|
63
64
|
flexGrow: 1,
|
|
64
65
|
flexShrink: 1,
|
|
65
66
|
minWidth: 40,
|
|
@@ -68,73 +69,69 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
68
69
|
return (
|
|
69
70
|
<box style={panelStyle}>
|
|
70
71
|
<box style={{ alignItems: 'center', justifyContent: 'center', marginBottom: 2 }}>
|
|
71
|
-
<text style={{ fg:
|
|
72
|
+
<text style={{ fg: theme.primary, marginBottom: 1 }}> OpenCode Stats</text>
|
|
72
73
|
</box>
|
|
73
74
|
|
|
74
75
|
<box style={{ flexDirection: 'row', marginBottom: 2 }}>
|
|
75
76
|
<box style={{ flexDirection: 'column', marginLeft: 2, width: '50%' }}>
|
|
76
|
-
<text style={{ fg:
|
|
77
|
+
<text style={{ fg: theme.key, marginBottom: 1 }}>Current Session</text>
|
|
77
78
|
{sessionState?.status === 'ready' ? (
|
|
78
79
|
<>
|
|
79
80
|
<text>
|
|
80
|
-
Messages: <span style={{ fg:
|
|
81
|
+
Messages: <span style={{ fg: theme.active }}>{sessionState.stats.messageCount ?? 0}</span>
|
|
81
82
|
</text>
|
|
82
83
|
<text>
|
|
83
|
-
Cost: <span style={{ fg:
|
|
84
|
+
Cost: <span style={{ fg: theme.action }}>${sessionCost.toFixed(2)}</span>
|
|
84
85
|
</text>
|
|
85
86
|
<text style={{ marginTop: 1 }}>
|
|
86
|
-
Context: <span style={{ fg:
|
|
87
|
-
<span style={{ fg:
|
|
87
|
+
Context: <span style={{ fg: theme.text }}>{formatNumber(lastMessageTokens)}</span>
|
|
88
|
+
<span style={{ fg: theme.action }}>/{contextPercentage}%</span>
|
|
88
89
|
</text>
|
|
89
90
|
</>
|
|
90
91
|
) : sessionState?.status === 'error' ? (
|
|
91
|
-
<text style={{ fg:
|
|
92
|
+
<text style={{ fg: theme.action }}>{sessionState.message}</text>
|
|
92
93
|
) : sessionState?.status === 'missing' ? (
|
|
93
|
-
<text style={{ fg:
|
|
94
|
+
<text style={{ fg: theme.inactive }}>{sessionState.message}</text>
|
|
94
95
|
) : (
|
|
95
|
-
<text style={{ fg:
|
|
96
|
+
<text style={{ fg: theme.inactive }}>Loading stats...</text>
|
|
96
97
|
)}
|
|
97
98
|
</box>
|
|
98
99
|
|
|
99
100
|
<box style={{ flexDirection: 'column', marginLeft: 2 }}>
|
|
100
|
-
<text style={{ fg:
|
|
101
|
+
<text style={{ fg: theme.key, marginBottom: 1 }}>Global Overview</text>
|
|
101
102
|
{globalStatsState.status === 'ready' ? (
|
|
102
103
|
<>
|
|
103
104
|
<text>
|
|
104
|
-
Sessions: <span style={{ fg:
|
|
105
|
+
Sessions: <span style={{ fg: theme.active }}>{globalStatsState.stats.totalSessions ?? 0}</span>
|
|
105
106
|
</text>
|
|
106
107
|
<text>
|
|
107
|
-
Messages: <span style={{ fg:
|
|
108
|
+
Messages: <span style={{ fg: theme.active }}>{globalStatsState.stats.totalMessages ?? 0}</span>
|
|
108
109
|
</text>
|
|
109
110
|
<text>
|
|
110
|
-
Total Cost:{
|
|
111
|
-
<span style={{ fg: colors.action }}>{globalStatsState.stats.totalCost ?? '$0.00'}</span>
|
|
111
|
+
Total Cost: <span style={{ fg: theme.action }}>{globalStatsState.stats.totalCost ?? '$0.00'}</span>
|
|
112
112
|
</text>
|
|
113
113
|
<text>
|
|
114
|
-
Cost/Day:{
|
|
115
|
-
<span style={{ fg: colors.text }}>{globalStatsState.stats.costPerDay ?? '$0.00'}</span>
|
|
114
|
+
Cost/Day: <span style={{ fg: theme.text }}>{globalStatsState.stats.costPerDay ?? '$0.00'}</span>
|
|
116
115
|
</text>
|
|
117
116
|
|
|
118
|
-
<text style={{ fg:
|
|
117
|
+
<text style={{ fg: theme.key, marginTop: 1, marginBottom: 1 }}>Token Usage</text>
|
|
119
118
|
<text>
|
|
120
|
-
Input: <span style={{ fg:
|
|
119
|
+
Input: <span style={{ fg: theme.text }}>{globalStatsState.stats.inputTokens ?? '0'}</span>
|
|
121
120
|
</text>
|
|
122
121
|
<text>
|
|
123
|
-
Output: <span style={{ fg:
|
|
122
|
+
Output: <span style={{ fg: theme.text }}>{globalStatsState.stats.outputTokens ?? '0'}</span>
|
|
124
123
|
</text>
|
|
125
124
|
<text>
|
|
126
|
-
Cache Read:{
|
|
127
|
-
<span style={{ fg: colors.inactive }}>{globalStatsState.stats.cacheRead ?? '0'}</span>
|
|
125
|
+
Cache Read: <span style={{ fg: theme.inactive }}>{globalStatsState.stats.cacheRead ?? '0'}</span>
|
|
128
126
|
</text>
|
|
129
127
|
<text>
|
|
130
|
-
Cache Write:{
|
|
131
|
-
<span style={{ fg: colors.inactive }}>{globalStatsState.stats.cacheWrite ?? '0'}</span>
|
|
128
|
+
Cache Write: <span style={{ fg: theme.inactive }}>{globalStatsState.stats.cacheWrite ?? '0'}</span>
|
|
132
129
|
</text>
|
|
133
130
|
</>
|
|
134
131
|
) : globalStatsState.status === 'error' ? (
|
|
135
|
-
<text style={{ fg:
|
|
132
|
+
<text style={{ fg: theme.action }}>{globalStatsState.message}</text>
|
|
136
133
|
) : (
|
|
137
|
-
<text style={{ fg:
|
|
134
|
+
<text style={{ fg: theme.inactive }}>Loading stats...</text>
|
|
138
135
|
)}
|
|
139
136
|
</box>
|
|
140
137
|
</box>
|
|
@@ -142,53 +139,51 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
142
139
|
{sessionStats && (
|
|
143
140
|
<>
|
|
144
141
|
<box style={{ alignItems: 'center', justifyContent: 'center', marginTop: 1 }}>
|
|
145
|
-
<text style={{ fg:
|
|
142
|
+
<text style={{ fg: theme.primary, marginBottom: 1 }}> Session Details</text>
|
|
146
143
|
</box>
|
|
147
144
|
|
|
148
145
|
<box style={{ flexDirection: 'column', marginLeft: 2 }}>
|
|
149
146
|
{sessionStats.title && (
|
|
150
147
|
<text style={{ marginBottom: 1 }}>
|
|
151
|
-
<span style={{ fg:
|
|
148
|
+
<span style={{ fg: theme.key }}>Title:</span> {sessionStats.title}
|
|
152
149
|
</text>
|
|
153
150
|
)}
|
|
154
151
|
|
|
155
|
-
{sessionStats.directory &&
|
|
156
|
-
<text style={{ marginBottom: 1, fg: colors.fileTree }}>{sessionStats.directory}</text>
|
|
157
|
-
)}
|
|
152
|
+
{sessionStats.directory && <text style={{ marginBottom: 1, fg: theme.fileTree }}>{sessionStats.directory}</text>}
|
|
158
153
|
|
|
159
154
|
{sessionStats.sessionCount !== undefined && (
|
|
160
155
|
<text>
|
|
161
|
-
Sessions: <span style={{ fg:
|
|
156
|
+
Sessions: <span style={{ fg: theme.active }}>{sessionStats.sessionCount}</span>
|
|
162
157
|
</text>
|
|
163
158
|
)}
|
|
164
159
|
|
|
165
160
|
{sessionStats.messageCount !== undefined && (
|
|
166
161
|
<text>
|
|
167
|
-
Messages: <span style={{ fg:
|
|
162
|
+
Messages: <span style={{ fg: theme.active }}>{sessionStats.messageCount}</span>
|
|
168
163
|
</text>
|
|
169
164
|
)}
|
|
170
165
|
|
|
171
166
|
{sessionStats.filesModified !== undefined && sessionStats.filesModified > 0 && (
|
|
172
167
|
<text>
|
|
173
|
-
Files Modified: <span style={{ fg:
|
|
168
|
+
Files Modified: <span style={{ fg: theme.action }}>{sessionStats.filesModified}</span>
|
|
174
169
|
</text>
|
|
175
170
|
)}
|
|
176
171
|
|
|
177
172
|
{sessionStats.mostRecentTitle && (
|
|
178
173
|
<text style={{ marginTop: 1 }}>
|
|
179
|
-
<span style={{ fg:
|
|
174
|
+
<span style={{ fg: theme.key }}>Most Recent:</span> {sessionStats.mostRecentTitle}
|
|
180
175
|
</text>
|
|
181
176
|
)}
|
|
182
177
|
|
|
183
178
|
{sessionStats.createdAt && (
|
|
184
179
|
<text style={{ marginTop: 1 }}>
|
|
185
|
-
Created: <span style={{ fg:
|
|
180
|
+
Created: <span style={{ fg: theme.inactive }}>{formatSessionAge(sessionStats.createdAt)}</span>
|
|
186
181
|
</text>
|
|
187
182
|
)}
|
|
188
183
|
|
|
189
184
|
{sessionStats.updatedAt && (
|
|
190
185
|
<text>
|
|
191
|
-
Updated: <span style={{ fg:
|
|
186
|
+
Updated: <span style={{ fg: theme.inactive }}>{formatSessionAge(sessionStats.updatedAt)}</span>
|
|
192
187
|
</text>
|
|
193
188
|
)}
|
|
194
189
|
</box>
|
|
@@ -197,7 +192,7 @@ export default function OpencodeStatsPanel({ selectedItem }: Props) {
|
|
|
197
192
|
|
|
198
193
|
{!selectedItem && (
|
|
199
194
|
<box style={{ marginTop: 2, marginLeft: 2 }}>
|
|
200
|
-
<text style={{ fg:
|
|
195
|
+
<text style={{ fg: theme.inactive }}>No session data found</text>
|
|
201
196
|
</box>
|
|
202
197
|
)}
|
|
203
198
|
</box>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { TextareaRenderable } from '@opentui/core'
|
|
2
|
+
import { useEffect } from 'react'
|
|
3
|
+
import { useTheme } from '../styles/theme'
|
|
4
|
+
import Modal from './Modal'
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
target: string
|
|
8
|
+
initialValue: string
|
|
9
|
+
columns: number
|
|
10
|
+
textareaRef: { current: TextareaRenderable | null }
|
|
11
|
+
onContentChange: () => void
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default function RenameModal({ target, initialValue, columns, textareaRef, onContentChange }: Props) {
|
|
15
|
+
const theme = useTheme()
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
queueMicrotask(() => {
|
|
19
|
+
const textarea = textareaRef.current
|
|
20
|
+
if (!textarea) {
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
textarea.focus()
|
|
25
|
+
textarea.gotoLineEnd()
|
|
26
|
+
})
|
|
27
|
+
}, [target, textareaRef])
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Modal
|
|
31
|
+
title='Rename Session'
|
|
32
|
+
description={`Update ${target}`}
|
|
33
|
+
footer='Enter apply'
|
|
34
|
+
columns={columns}
|
|
35
|
+
preferredWidth={60}
|
|
36
|
+
>
|
|
37
|
+
<box style={{ backgroundColor: theme.surfaceAlt, height: 3 }}>
|
|
38
|
+
<textarea ref={textareaRef} initialValue={initialValue} onContentChange={onContentChange} focused />
|
|
39
|
+
</box>
|
|
40
|
+
</Modal>
|
|
41
|
+
)
|
|
42
|
+
}
|
package/src/ui/SearchInput.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TextareaRenderable } from '@opentui/core'
|
|
2
2
|
import { useEffect } from 'react'
|
|
3
|
+
import { useTheme } from '../styles/theme'
|
|
3
4
|
import { AppMode } from '../types'
|
|
4
5
|
|
|
5
6
|
interface Props {
|
|
@@ -17,6 +18,7 @@ export default function SearchInput({
|
|
|
17
18
|
onContentChange,
|
|
18
19
|
prefixActive = false,
|
|
19
20
|
}: Props) {
|
|
21
|
+
const theme = useTheme()
|
|
20
22
|
const placeholder =
|
|
21
23
|
appMode === AppMode.NewSession
|
|
22
24
|
? 'Type project name, GitHub URL, or custom session name...'
|
|
@@ -45,7 +47,7 @@ export default function SearchInput({
|
|
|
45
47
|
style={{
|
|
46
48
|
marginBottom: 1,
|
|
47
49
|
height: 3,
|
|
48
|
-
backgroundColor: prefixActive ?
|
|
50
|
+
backgroundColor: prefixActive ? theme.surfaceAlt : theme.surface,
|
|
49
51
|
}}
|
|
50
52
|
>
|
|
51
53
|
<textarea
|