summaryrefslogtreecommitdiff
path: root/internal/tui/app.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/tui/app.go')
-rw-r--r--internal/tui/app.go60
1 files changed, 42 insertions, 18 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go
index 38457ff..9850595 100644
--- a/internal/tui/app.go
+++ b/internal/tui/app.go
@@ -459,43 +459,67 @@ func (m AppModel) View() string {
return "Loading..."
}
+ // Constrain content width for large displays
+ contentWidth := m.width
+ if contentWidth > maxContentWidth {
+ contentWidth = maxContentWidth
+ }
+
topBarHeight := 1
bottomBarHeight := 2
contentHeight := m.height - topBarHeight - bottomBarHeight
- // Timer box top-left
- timerBoxWidth := (m.width / 3)
- timerBoxHeight := (contentHeight / 2)
- if timerBoxWidth < 30 {
- timerBoxWidth = 30
+ // Sidebar: fixed comfortable width, capped to avoid dominating
+ sidebarWidth := 38
+ if sidebarWidth > contentWidth/3 {
+ sidebarWidth = contentWidth / 3
+ }
+ if sidebarWidth < 30 {
+ sidebarWidth = 30
+ }
+
+ // Timer box is compact - just needs enough for the timer display
+ timerBoxHeight := contentHeight * 2 / 5
+ if timerBoxHeight < 8 {
+ timerBoxHeight = 8
+ }
+ if timerBoxHeight > 14 {
+ timerBoxHeight = 14
}
- // Projects box bottom-left
- projectsBoxWidth := timerBoxWidth
+ // Projects box gets the rest of the left column
projectsBoxHeight := contentHeight - timerBoxHeight
// History box right side full height
- historyBoxWidth := m.width - projectsBoxWidth
+ historyBoxWidth := contentWidth - sidebarWidth
historyBoxHeight := contentHeight
- activeDur := m.timerBox.activeTime()
- stats := m.timeStats
- stats.TodayTotal += activeDur
- stats.WeekTotal += activeDur
+ topBar := RenderTopBar(m, contentWidth)
- topBar := RenderTopBar(m)
-
- timerBox := m.timerBox.View(timerBoxWidth, timerBoxHeight, m.selectedBox == TimerBox)
- projectsBox := m.projectsBox.View(projectsBoxWidth, projectsBoxHeight, m.selectedBox == ProjectsBox)
+ timerBox := m.timerBox.View(sidebarWidth, timerBoxHeight, m.selectedBox == TimerBox)
+ projectsBox := m.projectsBox.View(sidebarWidth, projectsBoxHeight, m.selectedBox == ProjectsBox)
historyBox := m.historyBox.View(historyBoxWidth, historyBoxHeight, m.selectedBox == HistoryBox, m.timerBox, m.projectsBox.clients, m.projectsBox.projects)
leftColumn := lipgloss.JoinVertical(lipgloss.Left, timerBox, projectsBox)
mainContent := lipgloss.JoinHorizontal(lipgloss.Top, leftColumn, historyBox)
keyBindings := activeBindings(m.selectedBox, m.historyBox.viewLevel, m.modalBox)
- bottomBar := RenderBottomBar(m, keyBindings, m.err)
+ bottomBar := RenderBottomBar(m, keyBindings, m.err, contentWidth)
+
+ fullView := topBar + "\n" + mainContent + "\n" + bottomBar
+
+ // Apply modal overlay (uses contentWidth for centering within the content area)
+ fullView = m.modalBox.RenderCenteredOver(fullView, m, contentWidth)
+
+ // Center the content if terminal is wider than max
+ if m.width > contentWidth {
+ fullView = lipgloss.NewStyle().
+ Width(m.width).
+ Align(lipgloss.Center).
+ Render(fullView)
+ }
- return m.modalBox.RenderCenteredOver(topBar+"\n"+mainContent+"\n"+bottomBar, m)
+ return fullView
}
// dataUpdatedMsg is sent when data is updated from the database