diff options
| author | T <t@tjp.lol> | 2026-02-19 19:42:22 -0700 |
|---|---|---|
| committer | T <t@tjp.lol> | 2026-02-19 19:42:57 -0700 |
| commit | 2ad5e85c729b4a32c4c49584e076ac9f6ce6fa60 (patch) | |
| tree | c6aa5db061504406f40d904399af4fb01857a0a9 /internal/tui/timer_box.go | |
| parent | 7ba68d333bc20b5795ccfd3870546a05eee60470 (diff) | |
re-skin
Diffstat (limited to 'internal/tui/timer_box.go')
| -rw-r--r-- | internal/tui/timer_box.go | 67 |
1 files changed, 26 insertions, 41 deletions
diff --git a/internal/tui/timer_box.go b/internal/tui/timer_box.go index 891004a..2b0c34a 100644 --- a/internal/tui/timer_box.go +++ b/internal/tui/timer_box.go @@ -1,10 +1,11 @@ package tui import ( - "fmt" "time" "git.tjp.lol/punchcard/internal/queries" + + "github.com/charmbracelet/lipgloss/v2" ) // TimerInfo holds information about the current or most recent timer state @@ -66,9 +67,13 @@ func (m TimerBoxModel) View(width, height int, isSelected bool) string { } // Apply box styling - style := unselectedBoxStyle + var style lipgloss.Style if isSelected { style = selectedBoxStyle + } else if m.timerInfo.IsActive { + style = activeBoxStyle + } else { + style = unselectedBoxStyle } return style.Width(width).Height(height).Render(content) @@ -76,67 +81,47 @@ func (m TimerBoxModel) View(width, height int, isSelected bool) string { // renderActiveTimer renders the active timer display func (m TimerBoxModel) renderActiveTimer() string { - content := titleStyle.Render("⏰ Active Timer") + "\n\n" + statusStyle := lipgloss.NewStyle().Foreground(colorTimerActive).Bold(true) + content := statusStyle.Render("TRACKING") + "\n\n" - // Timer duration - timerLine := fmt.Sprintf("Duration: %s", FormatDuration(m.currentTime.Sub(m.timerInfo.StartTime))) - content += activeTimerStyle.Render(timerLine) + "\n\n" + // Timer duration - big and bold + dur := FormatDuration(m.currentTime.Sub(m.timerInfo.StartTime)) + content += activeTimerStyle.Render(dur) + "\n\n" // Project/Client info + dimLabel := lipgloss.NewStyle().Foreground(colorDimmed) if m.timerInfo.ProjectName != "" { - projectLine := fmt.Sprintf("Project: %s / %s", m.timerInfo.ClientName, m.timerInfo.ProjectName) - content += projectLine + "\n" + content += dimLabel.Render(m.timerInfo.ClientName+" /") + "\n" + content += m.timerInfo.ProjectName + "\n" } else { - clientLine := fmt.Sprintf("Client: %s", m.timerInfo.ClientName) - content += clientLine + "\n" + content += m.timerInfo.ClientName + "\n" } - // Start time (convert from UTC to local) + // Start time localStartTime := m.timerInfo.StartTime.Local() - startLine := fmt.Sprintf("Started: %s", localStartTime.Format("3:04 PM")) - content += startLine + "\n" - - // Description if available - if m.timerInfo.Description != nil { - content += "\n" - descLine := fmt.Sprintf("Description: %s", *m.timerInfo.Description) - content += descLine + "\n" - } - - // Billable rate if available - if m.timerInfo.BillableRate != nil { - rateLine := fmt.Sprintf("Rate: $%.2f/hr", *m.timerInfo.BillableRate) - content += rateLine + "\n" - } + content += dimLabel.Render("since " + localStartTime.Format("3:04 PM")) return content } // renderInactiveTimer renders the inactive timer display func (m TimerBoxModel) renderInactiveTimer() string { - content := titleStyle.Render("⌛ Last Timer (Inactive)") + "\n\n" + statusStyle := lipgloss.NewStyle().Foreground(colorDimmed) + content := statusStyle.Render("IDLE") + "\n\n" if m.timerInfo.EntryID == 0 { - content += inactiveTimerStyle.Render("No time entries yet.\nSelect a client or project and\npunch in to start tracking time.") + content += inactiveTimerStyle.Render("No entries yet.\nPunch in to start.") return content } - timerLine := fmt.Sprintf("Duration: %s", FormatDuration(m.timerInfo.Duration)) - content += inactiveTimerStyle.Render(timerLine) + "\n\n" + content += inactiveTimerStyle.Render(FormatDuration(m.timerInfo.Duration)) + "\n\n" + dimLabel := lipgloss.NewStyle().Foreground(colorDimmed) if m.timerInfo.ProjectName != "" { - content += inactiveTimerStyle.Render(fmt.Sprintf("Project: %s / %s", m.timerInfo.ClientName, m.timerInfo.ProjectName)) + "\n" + content += dimLabel.Render(m.timerInfo.ClientName+" /") + "\n" + content += inactiveTimerStyle.Render(m.timerInfo.ProjectName) } else { - content += inactiveTimerStyle.Render(fmt.Sprintf("Client: %s", m.timerInfo.ClientName)) + "\n" - } - - content += inactiveTimerStyle.Render(fmt.Sprintf("Started: %s", m.timerInfo.StartTime.Local().Format("2006/01/02 3:04 PM"))) + "\n" - - if m.timerInfo.Description != nil { - content += "\n" + inactiveTimerStyle.Render(fmt.Sprintf("Description: %s", *m.timerInfo.Description)) + "\n" - } - if m.timerInfo.BillableRate != nil { - content += inactiveTimerStyle.Render(fmt.Sprintf("Rate: $%.2f/hr", *m.timerInfo.BillableRate)) + "\n" + content += inactiveTimerStyle.Render(m.timerInfo.ClientName) } return content |
