refactor(tui): consistent chrome across all views
- Extract divider() and emptyState() helpers to format.go - All empty states now use bordered box with accent color - Detail and alert detail panels get header/section dividers - SLA label width 14→16 to match detail/alert panels - Logs key hints moved from content to dashboard footer - History/SLA panels use shared divider helper
This commit is contained in:
@@ -2,11 +2,37 @@ package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"gitea.lerkolabs.com/lerkolabs/uptop/internal/models"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
)
|
||||
|
||||
func (m Model) dividerWidth() int {
|
||||
w := m.termWidth - chromePadH - 4
|
||||
if w < 40 {
|
||||
w = 40
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
func (m Model) divider() string {
|
||||
return " " + subtleStyle.Render(strings.Repeat("─", m.dividerWidth()))
|
||||
}
|
||||
|
||||
func (m Model) emptyState(message, hint string) string {
|
||||
content := message
|
||||
if hint != "" {
|
||||
content += "\n\n" + subtleStyle.Render(hint)
|
||||
}
|
||||
return "\n" + lipgloss.NewStyle().
|
||||
Border(lipgloss.RoundedBorder()).
|
||||
BorderForeground(m.theme.Accent).
|
||||
Padding(1, 3).
|
||||
Render(content)
|
||||
}
|
||||
|
||||
func limitStr(text string, max int) string {
|
||||
runes := []rune(text)
|
||||
if len(runes) > max {
|
||||
|
||||
Reference in New Issue
Block a user