fix(tui): use titledPanelH chrome for fullscreen detail view
CI / test (pull_request) Successful in 1m52s
CI / lint (pull_request) Successful in 1m22s
CI / vulncheck (pull_request) Successful in 56s

Match the sidebar's bordered panel style (╭─ Title ─╮) so the
fullscreen detail view on narrow terminals looks cohesive with the
rest of the UI. Breadcrumb now renders as the panel title.
This commit was merged in pull request #171.
This commit is contained in:
2026-07-01 16:22:49 -04:00
parent 989dd1fb39
commit b90033c7f0
+11 -29
View File
@@ -32,7 +32,7 @@ func (m Model) viewDetailFullscreen() string {
return "" return ""
} }
totalW := m.termWidth - chromePadH availW := m.termWidth - chromePadH
site := m.sites[m.cursor] site := m.sites[m.cursor]
var title string var title string
@@ -45,55 +45,37 @@ func (m Model) viewDetailFullscreen() string {
title = site.Name title = site.Name
} }
var breadcrumb string
if site.ParentID > 0 { if site.ParentID > 0 {
for _, s := range m.sites { for _, s := range m.sites {
if s.ID == site.ParentID { if s.ID == site.ParentID {
breadcrumb = m.st.subtleStyle.Render("Monitors > "+s.Name+" > ") + m.st.titleStyle.Render(site.Name) title = s.Name + " > " + title
break break
} }
} }
} }
if breadcrumb == "" {
breadcrumb = m.st.subtleStyle.Render("Monitors > ") + m.st.titleStyle.Render(title)
}
header := " " + breadcrumb + "\n" + m.divider() innerW := availW - 2
var content string var content string
switch m.detailMode { switch m.detailMode {
case detailSLA: case detailSLA:
content = m.viewSLASidebar(totalW, 0) content = m.viewSLASidebar(innerW, 0)
case detailHistory: case detailHistory:
content = m.viewHistorySidebar(totalW, 0) content = m.viewHistorySidebar(innerW, 0)
default: default:
hist, _ := m.engine.GetHistory(site.ID) hist, _ := m.engine.GetHistory(site.ID)
content = m.buildDetailContent(site, hist, totalW, true) content = m.buildDetailContent(site, hist, innerW, true)
} }
footer := m.divider() + "\n" + m.detailFooter(totalW) footer := m.detailFooter(innerW)
contentLines := strings.Split(content, "\n") panelH := m.termHeight - chromePadV
contentH := m.termHeight - 8 if panelH < 10 {
if contentH < 5 { panelH = 10
contentH = 5
} }
if m.detailScrollOffset > len(contentLines)-contentH {
m.detailScrollOffset = len(contentLines) - contentH
}
if m.detailScrollOffset < 0 {
m.detailScrollOffset = 0
}
end := m.detailScrollOffset + contentH
if end > len(contentLines) {
end = len(contentLines)
}
visible := strings.Join(contentLines[m.detailScrollOffset:end], "\n")
return lipgloss.NewStyle().Padding(1, 2).Render( return lipgloss.NewStyle().Padding(1, 2).Render(
header + "\n" + visible + "\n" + footer) m.titledPanelH(title, content, footer, availW, panelH, m.detailScrollOffset, true))
} }
func (m Model) buildDetailContent(site models.Site, hist monitor.SiteHistory, width int, fullscreen bool) string { func (m Model) buildDetailContent(site models.Site, hist monitor.SiteHistory, width int, fullscreen bool) string {