summaryrefslogtreecommitdiff
path: root/internal/tui/history_box.go
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-08-13 13:04:05 -0600
committerT <t@tjp.lol>2025-08-13 13:42:43 -0600
commit389b72e55b04ccfc02b04eb81cb8f7bb7a5c8b59 (patch)
treebe3015b2c7db90cddfc85d3e77ddc76213485494 /internal/tui/history_box.go
parent29c6581e08d0fe98433eff218de7701b51a6861c (diff)
history filtering
Diffstat (limited to 'internal/tui/history_box.go')
-rw-r--r--internal/tui/history_box.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go
index d2f71f9..c5c045e 100644
--- a/internal/tui/history_box.go
+++ b/internal/tui/history_box.go
@@ -26,8 +26,17 @@ type HistorySummaryKey struct {
ProjectID int64
}
+// HistoryFilter represents the filtering criteria for the history view
+type HistoryFilter struct {
+ StartDate time.Time // Required - start of date range to display
+ EndDate *time.Time // Optional - end of date range to display (nil means no end date)
+ ClientID *int64 // Optional - filter to specific client
+ ProjectID *int64 // Optional - filter to specific project
+}
+
type HistoryBoxModel struct {
viewLevel HistoryViewLevel
+ filter HistoryFilter
summaryItems []HistorySummaryItem
summarySelection int
@@ -60,7 +69,17 @@ func (item HistorySummaryItem) key() HistorySummaryKey {
// NewHistoryBoxModel creates a new history box model
func NewHistoryBoxModel() HistoryBoxModel {
- return HistoryBoxModel{}
+ now := time.Now()
+ startOfPreviousMonth := time.Date(now.Year(), now.Month()-1, 1, 0, 0, 0, 0, time.UTC)
+
+ return HistoryBoxModel{
+ filter: HistoryFilter{
+ StartDate: startOfPreviousMonth,
+ EndDate: nil,
+ ClientID: nil,
+ ProjectID: nil,
+ },
+ }
}
func buildIndex[T any, K comparable](items []T, keyf func(T) K) map[K][]T {