MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / renderCompactTab

Method renderCompactTab

internal/tui/tabbar.go:290–340  ·  view source on GitHub ↗

renderCompactTab renders a compact version of a tab.

(entry TabEntry, number int)

Source from the content-addressed store, hash-verified

288
289// renderCompactTab renders a compact version of a tab.
290func (t *TabBar) renderCompactTab(entry TabEntry, number int) string {
291 var content strings.Builder
292
293 // Shorter name
294 name := entry.Name
295 maxNameLen := 5
296 if len(name) > maxNameLen {
297 name = name[:maxNameLen-1] + "."
298 }
299
300 // Minimal state indicator
301 var stateIndicator string
302 switch entry.LoopState {
303 case loop.LoopStateRunning:
304 stateIndicator = "▶"
305 case loop.LoopStatePaused:
306 stateIndicator = "⏸"
307 case loop.LoopStateComplete:
308 stateIndicator = "✓"
309 case loop.LoopStateError:
310 stateIndicator = "✗"
311 }
312
313 // Active indicator
314 if entry.IsActive {
315 content.WriteString("◉")
316 }
317 content.WriteString(name)
318 if stateIndicator != "" {
319 content.WriteString(stateIndicator)
320 }
321
322 tabContent := content.String()
323
324 // Choose style
325 var style lipgloss.Style
326 if entry.IsActive {
327 style = TabActiveStyle
328 } else {
329 switch entry.LoopState {
330 case loop.LoopStateRunning:
331 style = TabRunningStyle
332 case loop.LoopStateError:
333 style = TabErrorStyle
334 default:
335 style = TabStyle
336 }
337 }
338
339 return style.Render(tabContent)
340}

Callers 2

RenderCompactMethod · 0.95

Calls 2

StringMethod · 0.45
RenderMethod · 0.45

Tested by 1