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.
@@ -1,7 +1,7 @@
1
1
  import { useEffect, useState } from 'react'
2
2
  import { getProjectPreview, type ProjectPreview } from '../preview/project'
3
3
  import { getSessionDetails } from '../tmux'
4
- import { colors, detailPanelStyle } from '../styles/theme'
4
+ import { getDetailPanelStyle, useTheme } from '../styles/theme'
5
5
  import type { Config, Item, SessionDetails } from '../types'
6
6
 
7
7
  interface Props {
@@ -19,140 +19,102 @@ type DetailState =
19
19
  function formatSourceLabel(source: ProjectPreview['source']): string {
20
20
  switch (source) {
21
21
  case 'project':
22
- return 'Project Rule'
22
+ return 'Project rule'
23
23
  case 'wildcard':
24
- return 'Wildcard Rule'
24
+ return 'Wildcard rule'
25
25
  case 'default':
26
- return 'Default Rule'
26
+ return 'Default rule'
27
27
  }
28
28
  }
29
29
 
30
- function ProjectPreviewView({ preview }: { preview: ProjectPreview }) {
30
+ function MetaRow(props: { label: string; value: string; color?: string }) {
31
+ const theme = useTheme()
32
+
31
33
  return (
32
- <>
33
- <box style={{ alignItems: 'center', justifyContent: 'center' }}>
34
- <text style={{ fg: colors.primary, marginBottom: 1 }}>{preview.sessionName}</text>
35
- </box>
34
+ <text>
35
+ <span style={{ fg: theme.textSubtle }}>{props.label}</span>{' '}
36
+ <span style={{ fg: props.color ?? theme.textMuted }}>{props.value}</span>
37
+ </text>
38
+ )
39
+ }
36
40
 
37
- <box style={{ flexDirection: 'column', marginBottom: 1, marginLeft: 2 }}>
38
- <text>
39
- Source: <span style={{ fg: colors.action }}>{formatSourceLabel(preview.source)}</span>
40
- </text>
41
- <text style={{ fg: colors.fileTree, marginTop: 1 }}>{preview.path}</text>
42
- {preview.gitRoot && preview.gitRoot !== preview.path && (
43
- <text>
44
- Git Root: <span style={{ fg: colors.fileTree }}>{preview.gitRoot}</span>
45
- </text>
46
- )}
47
- {preview.gitBranch && (
48
- <text>
49
- Branch: <span style={{ fg: colors.active }}>{preview.gitBranch}</span>
50
- </text>
51
- )}
52
- {preview.startupCommand && (
53
- <text style={{ marginTop: 1 }}>
54
- Startup: <span style={{ fg: colors.program }}>{preview.startupCommand}</span>
55
- </text>
56
- )}
57
- {preview.previewCommand && (
58
- <text>
59
- Preview Cmd: <span style={{ fg: colors.action }}>{preview.previewCommand}</span>
60
- </text>
61
- )}
41
+ function SectionLabel(props: { children: string }) {
42
+ const theme = useTheme()
43
+ return <text style={{ fg: theme.textSubtle, marginTop: 1 }}>{props.children}</text>
44
+ }
45
+
46
+ function ProjectPreviewView({ preview }: { preview: ProjectPreview }) {
47
+ const theme = useTheme()
48
+
49
+ return (
50
+ <box style={{ flexDirection: 'column' }}>
51
+ <text style={{ fg: theme.secondary }}>{preview.sessionName}</text>
52
+ <text style={{ fg: theme.fileTree, marginTop: 1 }}>{preview.path}</text>
53
+
54
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
55
+ <MetaRow label='Source' value={formatSourceLabel(preview.source)} color={theme.action} />
56
+ {preview.gitBranch && <MetaRow label='Branch' value={preview.gitBranch} color={theme.active} />}
57
+ {preview.startupCommand && <MetaRow label='Startup' value={preview.startupCommand} color={theme.program} />}
58
+ {preview.previewCommand && <MetaRow label='Preview' value={preview.previewCommand} color={theme.action} />}
62
59
  </box>
63
60
 
64
61
  {preview.linkedSession && (
65
- <>
66
- <box style={{ alignItems: 'center', justifyContent: 'center' }}>
67
- <text style={{ fg: colors.primary, marginBottom: 1 }}> Live Session</text>
68
- </box>
69
-
70
- <box style={{ flexDirection: 'column', marginBottom: 1, marginLeft: 2 }}>
71
- <text>
72
- Status:{' '}
73
- <span style={{ fg: preview.linkedSession.isAttached ? colors.active : colors.inactive }}>
74
- {preview.linkedSession.isAttached ? '● Attached' : '○ Detached'}
75
- </span>
76
- </text>
77
- <text>Windows: {preview.linkedSession.windowCount}</text>
78
- {preview.linkedSession.windows.slice(0, 4).map(window => (
79
- <text key={`${window.index}:${window.name}`} style={{ marginLeft: 2, fg: colors.inactive }}>
80
- {window.index}: {window.name}
81
- </text>
82
- ))}
83
- </box>
84
- </>
62
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
63
+ <SectionLabel>Live session</SectionLabel>
64
+ <MetaRow
65
+ label='Status'
66
+ value={preview.linkedSession.isAttached ? 'attached' : 'detached'}
67
+ color={preview.linkedSession.isAttached ? theme.active : theme.textMuted}
68
+ />
69
+ <MetaRow label='Windows' value={String(preview.linkedSession.windowCount)} />
70
+ </box>
85
71
  )}
86
72
 
87
- <box style={{ alignItems: 'center', justifyContent: 'center' }}>
88
- <text style={{ fg: colors.primary, marginBottom: 1 }}> {preview.previewLabel}</text>
89
- </box>
90
-
91
- <box style={{ flexDirection: 'column', marginLeft: 2 }}>
92
- {preview.previewNotice && (
93
- <text style={{ fg: colors.inactive, marginBottom: 1 }}>{preview.previewNotice}</text>
94
- )}
95
- {preview.previewLines.map((line, index) => (
96
- <text
97
- key={`${preview.previewKind}:${index}:${line}`}
98
- style={{
99
- fg: preview.previewKind === 'directory' && line.endsWith('/') ? colors.fileTree : colors.text,
100
- marginBottom: 1,
101
- }}
102
- >
73
+ <SectionLabel>{preview.previewLabel}</SectionLabel>
74
+ {preview.previewNotice && <text style={{ fg: theme.textSubtle, marginTop: 1 }}>{preview.previewNotice}</text>}
75
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
76
+ {preview.previewLines.slice(0, 12).map((line, index) => (
77
+ <text key={`${preview.previewKind}:${index}:${line}`} style={{ fg: line.endsWith('/') ? theme.fileTree : theme.textMuted }}>
103
78
  {line}
104
79
  </text>
105
80
  ))}
106
81
  </box>
107
- </>
82
+ </box>
108
83
  )
109
84
  }
110
85
 
111
86
  function SessionDetailsView({ details }: { details: SessionDetails }) {
112
- return (
113
- <>
114
- <box style={{ alignItems: 'center', justifyContent: 'center' }}>
115
- <text style={{ fg: colors.primary, marginBottom: 1 }}>{details.name}</text>
116
- </box>
87
+ const theme = useTheme()
117
88
 
118
- <box style={{ flexDirection: 'column', marginBottom: 1, marginLeft: 2 }}>
119
- <text>
120
- Status:{' '}
121
- <span style={{ fg: details.isAttached ? colors.active : colors.inactive }}>
122
- {details.isAttached ? '● Active' : '○ Inactive'}
123
- </span>
124
- </text>
125
- <text>Windows: {details.windowCount}</text>
126
- </box>
89
+ return (
90
+ <box style={{ flexDirection: 'column' }}>
91
+ <text style={{ fg: theme.secondary }}>{details.name}</text>
127
92
 
128
- <box style={{ alignItems: 'center', justifyContent: 'center' }}>
129
- <text style={{ fg: colors.primary, marginBottom: 1 }}> Windows</text>
93
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
94
+ <MetaRow label='Status' value={details.isAttached ? 'active' : 'inactive'} color={details.isAttached ? theme.active : theme.textMuted} />
95
+ <MetaRow label='Windows' value={String(details.windowCount)} />
130
96
  </box>
131
97
 
132
- <box style={{ flexDirection: 'column', marginLeft: 2 }}>
98
+ <SectionLabel>Windows</SectionLabel>
99
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
133
100
  {details.windows.length === 0 ? (
134
- <text style={{ fg: colors.inactive }}>No windows found</text>
101
+ <text style={{ fg: theme.textMuted }}>No windows found</text>
135
102
  ) : (
136
103
  details.windows.map(win => (
137
104
  <box key={`${win.index}:${win.name}`} style={{ flexDirection: 'column', marginBottom: 1 }}>
138
- <text>
139
- {win.index}: {win.name}
140
- </text>
141
- {win.currentCommand && (
142
- <text style={{ fg: colors.program, marginLeft: 2 }}> {win.currentCommand}</text>
143
- )}
144
- {win.currentPath && (
145
- <text style={{ fg: colors.fileTree, marginLeft: 2 }}> {win.currentPath}</text>
146
- )}
105
+ <text style={{ fg: theme.text }}>{win.index}: {win.name}</text>
106
+ {win.currentPath && <text style={{ fg: theme.fileTree }}>{win.currentPath}</text>}
107
+ {win.currentCommand && <text style={{ fg: theme.textSubtle }}>{win.currentCommand}</text>}
147
108
  </box>
148
109
  ))
149
110
  )}
150
111
  </box>
151
- </>
112
+ </box>
152
113
  )
153
114
  }
154
115
 
155
116
  export default function SessionDetailsPanel({ selectedItem, config }: Props) {
117
+ const theme = useTheme()
156
118
  const [detailState, setDetailState] = useState<DetailState>({ status: 'idle' })
157
119
 
158
120
  useEffect(() => {
@@ -202,7 +164,7 @@ export default function SessionDetailsPanel({ selectedItem, config }: Props) {
202
164
  }, [config, selectedItem])
203
165
 
204
166
  const panelStyle = {
205
- ...detailPanelStyle,
167
+ ...getDetailPanelStyle(theme),
206
168
  flexGrow: 1,
207
169
  flexShrink: 1,
208
170
  minWidth: 40,
@@ -212,18 +174,18 @@ export default function SessionDetailsPanel({ selectedItem, config }: Props) {
212
174
  <box style={panelStyle}>
213
175
  {detailState.status === 'idle' ? (
214
176
  <>
215
- <text style={{ fg: colors.primary, marginBottom: 1 }}>Details</text>
216
- <text style={{ fg: colors.inactive }}>No session or project selected</text>
177
+ <text style={{ fg: theme.textMuted }}>Nothing selected</text>
178
+ <text style={{ fg: theme.textSubtle, marginTop: 1 }}>Pick a session or project to see details.</text>
217
179
  </>
218
180
  ) : detailState.status === 'loading' ? (
219
181
  <>
220
- <text style={{ fg: colors.primary, marginBottom: 1 }}>{selectedItem?.title ?? 'Details'}</text>
221
- <text style={{ fg: colors.inactive }}>Loading...</text>
182
+ <text style={{ fg: theme.secondary }}>{selectedItem?.title ?? 'Details'}</text>
183
+ <text style={{ fg: theme.textSubtle, marginTop: 1 }}>Loading…</text>
222
184
  </>
223
185
  ) : detailState.status === 'error' ? (
224
186
  <>
225
- <text style={{ fg: colors.primary, marginBottom: 1 }}>{selectedItem?.title ?? 'Details'}</text>
226
- <text style={{ fg: colors.action }}>{detailState.message}</text>
187
+ <text style={{ fg: theme.secondary }}>{selectedItem?.title ?? 'Details'}</text>
188
+ <text style={{ fg: theme.danger, marginTop: 1 }}>{detailState.message}</text>
227
189
  </>
228
190
  ) : detailState.status === 'session' ? (
229
191
  <SessionDetailsView details={detailState.details} />
@@ -1,4 +1,4 @@
1
- import { colors } from '../styles/theme'
1
+ import { useTheme } from '../styles/theme'
2
2
  import { formatSessionAge } from '../util/time'
3
3
  import type { IconConfig, Item } from '../types'
4
4
  import { getSessionSection } from '../items/order'
@@ -12,9 +12,18 @@ interface Props {
12
12
  maxItems?: number
13
13
  searchQuery?: string
14
14
  icons?: IconConfig
15
+ pendingKillSessionName?: string | null
15
16
  }
16
17
 
17
- export default function SessionList({ items, cursor, maxItems = 20, searchQuery = '', icons }: Props) {
18
+ export default function SessionList({
19
+ items,
20
+ cursor,
21
+ maxItems = 20,
22
+ searchQuery = '',
23
+ icons,
24
+ pendingKillSessionName,
25
+ }: Props) {
26
+ const theme = useTheme()
18
27
  const isSearching = searchQuery.trim().length > 0
19
28
  const visibleWindow = getVisibleWindow(items, cursor, maxItems)
20
29
 
@@ -23,64 +32,46 @@ export default function SessionList({ items, cursor, maxItems = 20, searchQuery
23
32
  {visibleWindow.items.map((item, i) => {
24
33
  const absoluteIndex = visibleWindow.startIndex + i
25
34
  const matchIndices = item.searchMatch?.titleIndices
26
- const titlePadded = item.title.padEnd(20)
27
- const itemMeta = item.isSession
28
- ? item.createdAt
29
- ? formatSessionAge(item.createdAt)
30
- : ''
31
- : item.desc
32
- const icon = getItemIconPresentation(item, icons)
35
+ const itemMeta = item.isSession && item.createdAt ? formatSessionAge(item.createdAt) : ''
36
+ const icon = getItemIconPresentation(theme, item, icons)
33
37
  const currentSection = getSessionSection(item)
34
38
  const previousItem = absoluteIndex > 0 ? items[absoluteIndex - 1] : undefined
35
39
  const previousSection = previousItem ? getSessionSection(previousItem) : undefined
36
40
  const showSectionHeader = i === 0 || currentSection !== previousSection
37
- const sectionHeader = formatSectionHeader(currentSection, icons)
41
+ const sectionHeader = formatSectionHeader(theme, currentSection, icons)
42
+ const pendingKill = item.title === pendingKillSessionName
43
+ const selected = absoluteIndex === cursor
38
44
 
39
45
  return (
40
46
  <box key={i} style={{ flexDirection: 'column' }}>
41
47
  {showSectionHeader && (
42
- <text style={{ fg: colors.separator, marginTop: absoluteIndex === 0 ? 0 : 1, marginBottom: 1 }}>
48
+ <text style={{ fg: theme.textSubtle, marginTop: absoluteIndex === 0 ? 0 : 1, marginBottom: 1 }}>
43
49
  <span style={{ fg: sectionHeader.color }}>{sectionHeader.text}</span>
44
50
  </text>
45
51
  )}
52
+
46
53
  <box
47
54
  style={{
48
- backgroundColor: absoluteIndex === cursor ? colors.backgroundAlt : 'transparent',
49
- height: 1,
50
- paddingLeft: 2,
55
+ flexDirection: 'row',
56
+ justifyContent: 'space-between',
57
+ backgroundColor: pendingKill ? theme.dangerSurface : selected ? theme.surfaceAlt : 'transparent',
58
+ paddingLeft: 1,
59
+ paddingRight: 1,
51
60
  }}
52
61
  >
53
- {absoluteIndex === cursor && <text> </text>}
54
62
  <text>
55
- {absoluteIndex + 1}{' '}
56
- {item.isSession ? (
57
- <>
58
- <span style={{ fg: item.isAttached ? colors.active : colors.inactive }}>
59
- {item.isAttached ? '●' : '○'}
60
- </span>{' '}
61
- {isSearching && matchIndices && matchIndices.length > 0 ? (
62
- <>
63
- <HighlightedText text={item.title} matchIndices={matchIndices} />
64
- {' '.repeat(20 - item.title.length)}
65
- </>
66
- ) : (
67
- titlePadded
68
- )}{' '}
69
- </>
63
+ <span style={{ fg: selected ? theme.primary : theme.textSubtle }}>{selected ? '› ' : ' '}</span>
64
+ <span style={{ fg: item.isAttached ? theme.active : theme.inactive }}>{item.isAttached ? '●' : '○'}</span>
65
+ <span style={{ fg: icon.color }}>{icon.glyph ? ` ${icon.glyph}` : ''}</span>{' '}
66
+ {isSearching && matchIndices && matchIndices.length > 0 ? (
67
+ <HighlightedText text={item.title} matchIndices={matchIndices} />
70
68
  ) : (
71
- <>
72
- <span style={{ fg: icon.color }}>{icon.glyph}</span>{' '}
73
- {isSearching && matchIndices && matchIndices.length > 0 ? (
74
- <>
75
- <HighlightedText text={item.title} matchIndices={matchIndices} />
76
- {' '.repeat(20 - item.title.length)}
77
- </>
78
- ) : (
79
- titlePadded
80
- )}{' '}
81
- </>
69
+ <span style={{ fg: theme.text }}>{item.title}</span>
82
70
  )}
83
- <span style={{ fg: colors.inactive }}>{itemMeta}</span>
71
+ </text>
72
+
73
+ <text style={{ fg: pendingKill ? theme.danger : theme.textSubtle }}>
74
+ {pendingKill ? 'press d again to kill' : itemMeta}
84
75
  </text>
85
76
  </box>
86
77
  </box>
@@ -1,4 +1,4 @@
1
- import { colors } from '../styles/theme'
1
+ import { useTheme } from '../styles/theme'
2
2
 
3
3
  interface Props {
4
4
  totalSessions: number
@@ -15,14 +15,16 @@ export default function SessionStats({
15
15
  oldestSession,
16
16
  newestSession,
17
17
  }: Props) {
18
+ const theme = useTheme()
19
+
18
20
  if (totalSessions === 0) return null
19
21
 
20
22
  return (
21
23
  <>
22
- <text style={{ marginTop: 2, fg: colors.text }}>
24
+ <text style={{ marginTop: 1, fg: theme.textMuted }}>
23
25
  Sessions: {totalSessions} ({activeSessions} active, {idleSessions} idle)
24
26
  </text>
25
- <text style={{ fg: colors.text }}>
27
+ <text style={{ fg: theme.textSubtle }}>
26
28
  Oldest: {oldestSession} Newest: {newestSession}
27
29
  </text>
28
30
  </>
@@ -0,0 +1,49 @@
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
+ title: string
8
+ description: string
9
+ value: string
10
+ error?: string
11
+ columns: number
12
+ rows: number
13
+ textareaRef: { current: TextareaRenderable | null }
14
+ onContentChange: () => void
15
+ }
16
+
17
+ export default function SettingEditorModal({
18
+ title,
19
+ description,
20
+ value,
21
+ error,
22
+ columns,
23
+ rows,
24
+ textareaRef,
25
+ onContentChange,
26
+ }: Props) {
27
+ const theme = useTheme()
28
+
29
+ useEffect(() => {
30
+ queueMicrotask(() => {
31
+ textareaRef.current?.focus()
32
+ })
33
+ }, [textareaRef])
34
+
35
+ return (
36
+ <Modal title={title} description={description} footer='Enter apply' columns={columns} preferredWidth={88}>
37
+ {error && <text style={{ fg: theme.danger, marginBottom: 1 }}>{error}</text>}
38
+
39
+ <box
40
+ style={{
41
+ backgroundColor: theme.surfaceAlt,
42
+ height: Math.max(6, rows - 16),
43
+ }}
44
+ >
45
+ <textarea ref={textareaRef} initialValue={value} onContentChange={onContentChange} focused />
46
+ </box>
47
+ </Modal>
48
+ )
49
+ }
@@ -0,0 +1,77 @@
1
+ import type { TextareaRenderable } from '@opentui/core'
2
+ import { useEffect } from 'react'
3
+ import { useTheme } from '../styles/theme'
4
+ import type { SettingsOption } from '../settings'
5
+ import Modal from './Modal'
6
+
7
+ interface Props {
8
+ title: string
9
+ description: string
10
+ columns: number
11
+ options: SettingsOption[]
12
+ cursor: number
13
+ searchQuery: string
14
+ textareaRef: { current: TextareaRenderable | null }
15
+ onContentChange: () => void
16
+ }
17
+
18
+ export default function SettingOptionsModal({
19
+ title,
20
+ description,
21
+ columns,
22
+ options,
23
+ cursor,
24
+ searchQuery,
25
+ textareaRef,
26
+ onContentChange,
27
+ }: Props) {
28
+ const theme = useTheme()
29
+ const selected = options[cursor]
30
+
31
+ useEffect(() => {
32
+ queueMicrotask(() => {
33
+ textareaRef.current?.focus()
34
+ })
35
+ }, [textareaRef])
36
+
37
+ return (
38
+ <Modal title={title} description={description} footer='↑/↓ navigate enter apply esc back' columns={columns} preferredWidth={68}>
39
+ <box style={{ backgroundColor: theme.surfaceAlt, paddingLeft: 1, paddingRight: 1, marginBottom: 1 }}>
40
+ <textarea ref={textareaRef} initialValue={searchQuery} onContentChange={onContentChange} focused placeholder='Filter options' />
41
+ </box>
42
+
43
+ <box style={{ flexDirection: 'column' }}>
44
+ {options.length === 0 ? (
45
+ <text style={{ fg: theme.textMuted }}>No options found</text>
46
+ ) : (
47
+ options.map((option, index) => {
48
+ const active = index === cursor
49
+
50
+ return (
51
+ <box
52
+ key={option.value}
53
+ style={{
54
+ flexDirection: 'row',
55
+ justifyContent: 'space-between',
56
+ backgroundColor: active ? theme.selection : 'transparent',
57
+ paddingLeft: 1,
58
+ paddingRight: 1,
59
+ }}
60
+ >
61
+ <text style={{ fg: active ? theme.selectionText : theme.text }}>{option.label}</text>
62
+ <text style={{ fg: active ? theme.selectionText : theme.textMuted }}>{option.value}</text>
63
+ </box>
64
+ )
65
+ })
66
+ )}
67
+ </box>
68
+
69
+ {selected && selected.description && (
70
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
71
+ <text style={{ fg: theme.accent }}>{selected.label}</text>
72
+ <text style={{ fg: theme.textMuted }}>{selected.description}</text>
73
+ </box>
74
+ )}
75
+ </Modal>
76
+ )
77
+ }
@@ -0,0 +1,96 @@
1
+ import type { TextareaRenderable } from '@opentui/core'
2
+ import { useEffect } from 'react'
3
+ import { useTheme } from '../styles/theme'
4
+ import type { SettingsEntry } from '../settings'
5
+ import Modal from './Modal'
6
+
7
+ interface Props {
8
+ configPath: string
9
+ themeName: string
10
+ colorMode: string
11
+ columns: number
12
+ entries: SettingsEntry[]
13
+ cursor: number
14
+ searchQuery: string
15
+ textareaRef: { current: TextareaRenderable | null }
16
+ onContentChange: () => void
17
+ }
18
+
19
+ export default function SettingsModal({
20
+ configPath,
21
+ themeName,
22
+ colorMode,
23
+ columns,
24
+ entries,
25
+ cursor,
26
+ searchQuery,
27
+ textareaRef,
28
+ onContentChange,
29
+ }: Props) {
30
+ const theme = useTheme()
31
+ const selected = entries[cursor]
32
+
33
+ useEffect(() => {
34
+ queueMicrotask(() => {
35
+ textareaRef.current?.focus()
36
+ })
37
+ }, [textareaRef])
38
+
39
+ return (
40
+ <Modal
41
+ title='Settings'
42
+ description='Search for a setting, then open its option or editor screen'
43
+ footer='↑/↓ navigate enter open esc close'
44
+ columns={columns}
45
+ preferredWidth={74}
46
+ >
47
+ <box style={{ flexDirection: 'column', marginBottom: 1 }}>
48
+ <text style={{ fg: theme.textMuted }}>Path: {configPath}</text>
49
+ <text style={{ fg: theme.textMuted }}>{themeName} ({colorMode})</text>
50
+ </box>
51
+
52
+ <box style={{ backgroundColor: theme.surfaceAlt, paddingLeft: 1, paddingRight: 1, marginBottom: 1 }}>
53
+ <textarea
54
+ ref={textareaRef}
55
+ initialValue={searchQuery}
56
+ onContentChange={onContentChange}
57
+ focused
58
+ placeholder='Search settings'
59
+ />
60
+ </box>
61
+
62
+ <box style={{ flexDirection: 'column' }}>
63
+ {entries.length === 0 ? (
64
+ <text style={{ fg: theme.textMuted }}>No settings found</text>
65
+ ) : (
66
+ entries.map((entry, index) => {
67
+ const active = index === cursor
68
+
69
+ return (
70
+ <box
71
+ key={entry.id}
72
+ style={{
73
+ flexDirection: 'row',
74
+ justifyContent: 'space-between',
75
+ backgroundColor: active ? theme.selection : 'transparent',
76
+ paddingLeft: 1,
77
+ paddingRight: 1,
78
+ }}
79
+ >
80
+ <text style={{ fg: active ? theme.selectionText : theme.text }}>{entry.label}</text>
81
+ <text style={{ fg: active ? theme.selectionText : theme.textMuted }}>{entry.value}</text>
82
+ </box>
83
+ )
84
+ })
85
+ )}
86
+ </box>
87
+
88
+ {selected && (
89
+ <box style={{ flexDirection: 'column', marginTop: 1 }}>
90
+ <text style={{ fg: theme.accent }}>{selected.label}</text>
91
+ <text style={{ fg: theme.textMuted }}>{selected.hint}</text>
92
+ </box>
93
+ )}
94
+ </Modal>
95
+ )
96
+ }
package/src/ui/Toast.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import { colors } from '../styles/theme'
1
+ import { useTheme } from '../styles/theme'
2
2
 
3
3
  interface ToastProps {
4
4
  message: string
@@ -6,6 +6,8 @@ interface ToastProps {
6
6
  }
7
7
 
8
8
  export default function Toast({ message, visible }: ToastProps) {
9
+ const theme = useTheme()
10
+
9
11
  if (!visible) return null
10
12
 
11
13
  return (
@@ -14,18 +16,15 @@ export default function Toast({ message, visible }: ToastProps) {
14
16
  position: 'absolute',
15
17
  top: 1,
16
18
  right: 1,
17
- border: true,
18
- borderColor: colors.primary,
19
- padding: 0.3,
20
- paddingLeft: 0.5,
21
- paddingRight: 0.5,
19
+ backgroundColor: theme.surfaceAlt,
20
+ paddingLeft: 1,
21
+ paddingRight: 1,
22
22
  height: 2,
23
23
  }}
24
24
  >
25
25
  <box>
26
- {/* <text style={{ fg: colors.key }}>󰙎 </text> */}
27
- <text style={{ fg: colors.key }}> </text>
28
- <text style={{ fg: colors.active, marginLeft: 1 }}> {message}</text>
26
+ <text style={{ fg: theme.secondary }}>●</text>
27
+ <text style={{ fg: theme.textMuted, marginLeft: 1 }}>{message}</text>
29
28
  </box>
30
29
  </box>
31
30
  )