fix: dashboard widths made symmetric
This commit is contained in:
@@ -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
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user