diff options
Diffstat (limited to 'internal/tui/app.go')
-rw-r--r-- | internal/tui/app.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go index 2ba2a9b..c94adfd 100644 --- a/internal/tui/app.go +++ b/internal/tui/app.go @@ -65,6 +65,7 @@ type AppModel struct { timerBox TimerBoxModel projectsBox ClientsProjectsModel historyBox HistoryBoxModel + modalBox ModalBoxModel width int height int @@ -161,6 +162,9 @@ func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.historyBox.drillUp() } + case searchActivated: + m.modalBox.activate(ModalTypeSearch) + } return m, tea.Batch(cmds...) @@ -173,23 +177,23 @@ func (m AppModel) View() string { } topBarHeight := 1 - bottomBarHeight := 1 + bottomBarHeight := 2 contentHeight := m.height - topBarHeight - bottomBarHeight - vertBoxOverhead := 6 // 2 border, 4 padding - horizBoxOverhead := 4 // 2 border, 2 padding - // Timer box top-left - timerBoxWidth := (m.width / 3) - horizBoxOverhead - timerBoxHeight := (contentHeight / 2) - vertBoxOverhead + timerBoxWidth := (m.width / 3) + timerBoxHeight := (contentHeight / 2) + if timerBoxWidth < 30 { + timerBoxWidth = 30 + } // Projects box bottom-left - projectsBoxWidth := (m.width / 3) - horizBoxOverhead - projectsBoxHeight := (contentHeight / 2) - vertBoxOverhead + projectsBoxWidth := timerBoxWidth + projectsBoxHeight := (contentHeight / 2) // History box right side full height - historyBoxWidth := (m.width * 2 / 3) - horizBoxOverhead - historyBoxHeight := contentHeight - vertBoxOverhead + historyBoxWidth := m.width - projectsBoxWidth + historyBoxHeight := contentHeight activeDur := m.timerBox.activeTime() stats := m.timeStats @@ -208,7 +212,7 @@ func (m AppModel) View() string { keyBindings := activeBindings(m.selectedBox, m.historyBox.viewLevel) bottomBar := RenderBottomBar(m, keyBindings, m.err) - return topBar + "\n" + mainContent + "\n" + bottomBar + return m.modalBox.RenderCenteredOver(topBar + "\n" + mainContent + "\n" + bottomBar, m) } // dataUpdatedMsg is sent when data is updated from the database |