fix: dashboard widths made symmetric

This commit is contained in:
2026-04-30 14:48:31 +02:00
parent 60d5b73871
commit 06d8624f92
2 changed files with 14 additions and 5 deletions
+2
View File
@@ -20,6 +20,8 @@ var (
var ( var (
pageStyle = lipgloss.NewStyle(). pageStyle = lipgloss.NewStyle().
Padding(1, 2) Padding(1, 2)
dashboardPageStyle = lipgloss.NewStyle().
Padding(1, 1)
titleStyle = lipgloss.NewStyle(). titleStyle = lipgloss.NewStyle().
Bold(true). Bold(true).
Foreground(titleColor) Foreground(titleColor)
+12 -5
View File
@@ -9,6 +9,8 @@ import (
"parasocial/internal/twitch" "parasocial/internal/twitch"
) )
const dashboardPanelGap = 1
// View renders either the login log screen or the authenticated streamer dashboard. // View renders either the login log screen or the authenticated streamer dashboard.
func (m Model) View() string { func (m Model) View() string {
if m.mode == authView { if m.mode == authView {
@@ -50,8 +52,8 @@ func (m Model) renderStreamerView() string {
Height(panelHeight(m.height)). Height(panelHeight(m.height)).
Render(m.renderDetailPanel()) Render(m.renderDetailPanel())
body := lipgloss.JoinHorizontal(lipgloss.Top, left, " ", right) body := lipgloss.JoinHorizontal(lipgloss.Top, left, strings.Repeat(" ", dashboardPanelGap), right)
return pageStyle.Render(header+"\n\n"+body) + "\n" return dashboardPageStyle.Render(header+"\n\n"+body) + "\n"
} }
func (m Model) renderDashboardHeader() string { func (m Model) renderDashboardHeader() string {
@@ -259,13 +261,18 @@ func streamerListWidth(width int) int {
func detailWidth(width int) int { func detailWidth(width int) int {
if width <= 0 { if width <= 0 {
return defaultViewWidth - streamerListWidth(width) - 7 width = defaultViewWidth
} }
return max(24, width-streamerListWidth(width)-11) usedWidth := dashboardPageStyle.GetHorizontalPadding() +
streamerListWidth(width) +
panelStyle.GetHorizontalBorderSize() +
dashboardPanelGap +
panelStyle.GetHorizontalBorderSize()
return max(24, width-usedWidth)
} }
func detailViewportWidth(width int) int { func detailViewportWidth(width int) int {
return max(16, detailWidth(width)-4) return max(16, detailWidth(width)-panelStyle.GetHorizontalPadding())
} }
func streamerListHeight(height int) int { func streamerListHeight(height int) int {