summaryrefslogtreecommitdiff
path: root/internal/tui
diff options
context:
space:
mode:
authorT <t@tjp.lol>2025-08-06 16:56:46 -0600
committerT <t@tjp.lol>2025-08-07 08:33:49 -0600
commit4843deb9cfa6d91282c5124ec025c636137e9e94 (patch)
tree180dc226e7dcdbbba8ea6ecabba821f4bdb64949 /internal/tui
parentd75bd93385bf3b54ada84c3d45011d7f8efc1f80 (diff)
Enhanced date range parsing with more flexible input formats
- Added support for 'this week' and 'this month' date ranges - Added support for month names (e.g., 'february', 'july') with automatic year detection - Added support for 'month year' format (e.g., 'july 2023', 'feb 2022') - Enhanced help text and examples for all report commands - Added comprehensive test coverage for date range parsing - Fixed timezone handling in TUI history display - Minor code style improvements
Diffstat (limited to 'internal/tui')
-rw-r--r--internal/tui/app.go2
-rw-r--r--internal/tui/history_box.go8
-rw-r--r--internal/tui/projects_box.go5
3 files changed, 7 insertions, 8 deletions
diff --git a/internal/tui/app.go b/internal/tui/app.go
index c94adfd..28f04dc 100644
--- a/internal/tui/app.go
+++ b/internal/tui/app.go
@@ -189,7 +189,7 @@ func (m AppModel) View() string {
// Projects box bottom-left
projectsBoxWidth := timerBoxWidth
- projectsBoxHeight := (contentHeight / 2)
+ projectsBoxHeight := contentHeight - timerBoxHeight
// History box right side full height
historyBoxWidth := m.width - projectsBoxWidth
diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go
index 799947d..847b4fc 100644
--- a/internal/tui/history_box.go
+++ b/internal/tui/history_box.go
@@ -96,7 +96,7 @@ func (m *HistoryBoxModel) regenerateSummaries(
if entry.ProjectID.Valid {
projectID = entry.ProjectID.Int64
}
- return HistorySummaryKey{dateOnly(entry.StartTime), entry.ClientID, projectID}
+ return HistorySummaryKey{dateOnly(entry.StartTime.Local()), entry.ClientID, projectID}
})
for key, entries := range m.entries {
@@ -109,7 +109,7 @@ func (m *HistoryBoxModel) regenerateSummaries(
}
item := HistorySummaryItem{
- Date: key.Date,
+ Date: key.Date.Local(),
ClientID: key.ClientID,
ClientName: clientNames[key.ClientID],
TotalDuration: totalDur,
@@ -285,7 +285,7 @@ func (m HistoryBoxModel) renderSummaryView(timer TimerBoxModel) string {
func (m HistoryBoxModel) selectedEntries() []queries.TimeEntry {
summary := m.summaryItems[m.summarySelection]
key := HistorySummaryKey{
- Date: summary.Date,
+ Date: summary.Date.Local(),
ClientID: summary.ClientID,
}
if summary.ProjectID != nil {
@@ -362,7 +362,7 @@ func (m HistoryBoxModel) formatSummaryTitle(summary HistorySummaryItem) string {
if summary.ProjectID != nil {
return fmt.Sprintf("%s / %s", summary.ClientName, *summary.ProjectName)
}
- return fmt.Sprintf("%s", summary.ClientName)
+ return summary.ClientName
}
func dateOnly(t time.Time) time.Time {
diff --git a/internal/tui/projects_box.go b/internal/tui/projects_box.go
index 38fd96a..f40cbd0 100644
--- a/internal/tui/projects_box.go
+++ b/internal/tui/projects_box.go
@@ -112,7 +112,7 @@ func (m *ClientsProjectsModel) changeSelectionForward() {
// starting with a client selected
if len(projects) > 0 {
// can jump into the first project
- var zero int = 0
+ zero := 0
m.selectedProject = &zero
return
}
@@ -147,7 +147,6 @@ func (m *ClientsProjectsModel) changeSelectionForward() {
func (m *ClientsProjectsModel) changeSelectionBackward() {
selectedClient := m.clients[m.selectedClient]
- projects := m.projects[selectedClient.ID]
if m.selectedProject == nil {
// starting with a client selected
@@ -158,7 +157,7 @@ func (m *ClientsProjectsModel) changeSelectionBackward() {
m.selectedClient--
selectedClient = m.clients[m.selectedClient]
- projects = m.projects[selectedClient.ID]
+ projects := m.projects[selectedClient.ID]
if len(projects) > 0 {
// previous client has projects, jump to last one