summaryrefslogtreecommitdiff
path: root/internal/tui/app.go
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-08-19 12:12:54 -0600
committerT <t@tjp.lol>2025-08-19 12:13:26 -0600
commit70dcaa2f10591ae76d908c93980babe205e4a884 (patch)
tree8b59d45f723c84d15b69235ffcf8268b89779616 /internal/tui/app.go
parent3cd97f651e02205d0d6f554a83da1ff7efe73609 (diff)
[f] key on projects box to filter the history view to the selected client or project
Diffstat (limited to 'internal/tui/app.go')
-rw-r--r--internal/tui/app.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go
index d21df5c..6bcc77d 100644
--- a/internal/tui/app.go
+++ b/internal/tui/app.go
@@ -226,11 +226,27 @@ func (m AppModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.openReportModal()
}
+ case filterHistoryByProjectBox:
+ if m.selectedBox == ProjectsBox {
+ m.filterHistoryByProjectBox()
+ }
+ cmds = append(cmds, m.refreshCmd)
}
return m, tea.Batch(cmds...)
}
+func (m *AppModel) filterHistoryByProjectBox() {
+ selectedClient := m.projectsBox.clients[m.projectsBox.selectedClient]
+ m.historyBox.filter.ClientID = &selectedClient.ID
+ if m.projectsBox.selectedProject != nil {
+ project := m.projectsBox.projects[selectedClient.ID][*m.projectsBox.selectedProject]
+ m.historyBox.filter.ProjectID = &project.ID
+ } else {
+ m.historyBox.filter.ProjectID = nil
+ }
+}
+
func (m *AppModel) openEntryEditor() {
m.modalBox.activate(ModalTypeEntry, m.historyBox.selectedEntry().ID, *m)
m.modalBox.form.fields[0].Focus()