From 2ad5e85c729b4a32c4c49584e076ac9f6ce6fa60 Mon Sep 17 00:00:00 2001 From: T Date: Thu, 19 Feb 2026 19:42:22 -0700 Subject: re-skin --- internal/tui/history_box.go | 81 ++++++++++++++++++++++++--------------------- 1 file changed, 44 insertions(+), 37 deletions(-) (limited to 'internal/tui/history_box.go') diff --git a/internal/tui/history_box.go b/internal/tui/history_box.go index 17958c3..9e01f2f 100644 --- a/internal/tui/history_box.go +++ b/internal/tui/history_box.go @@ -184,7 +184,7 @@ func (m HistoryBoxModel) View(width, height int, isSelected bool, timer TimerBox var content string if len(m.entries) == 0 { - content = "📝 Recent History\n\n" + content = titleStyle.Render("History") + "\n\n" content += inactiveTimerStyle.Render("No recent entries\n\nStart tracking time to\nsee your history here.") } else { switch m.viewLevel { @@ -224,23 +224,18 @@ func (m HistoryBoxModel) selectionHeight() int { } func (m HistoryBoxModel) summarySelectionHeight() int { - height := 1 // "Recent History" title line - - if len(m.summaryItems) > 0 { - height += 3 // 2 newlines + filter info line - } + height := 1 // title line (History + filter info on same line) var date *time.Time for i, item := range m.summaryItems { if date == nil || !date.Equal(item.Date) { date = &item.Date - height += 4 // 2 newlines, the date, 1 more newline + height += 2 // blank line + date header } - height += 1 // newline before the selectable line + height += 1 // the entry line if i == m.summarySelection { return height } - height += 1 // the selectable line that's not selected } return 0 } @@ -259,25 +254,26 @@ func (m HistoryBoxModel) detailsSelectionHeight() int { var ( titleStyle = lipgloss.NewStyle().Bold(true) - dateStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("3")) + dateStyle = lipgloss.NewStyle().Bold(true).Foreground(colorDate) summaryItemStyle = lipgloss.NewStyle() - selectedItemStyle = lipgloss.NewStyle().Background(lipgloss.Color("62")).Foreground(lipgloss.Color("230")) + selectedItemStyle = lipgloss.NewStyle().Background(colorSelected).Foreground(colorSelectedFg) + durationStyle = lipgloss.NewStyle().Foreground(colorDimmed) entryStyle = lipgloss.NewStyle() - selectedEntryStyle = lipgloss.NewStyle().Background(lipgloss.Color("62")).Foreground(lipgloss.Color("230")) - activeEntryStyle = lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("196")) - selectedActiveEntryStyle = lipgloss.NewStyle().Background(lipgloss.Color("196")).Foreground(lipgloss.Color("230")) - descriptionStyle = lipgloss.NewStyle() - activeDescriptionStyle = lipgloss.NewStyle().Background(lipgloss.Color("62")).Foreground(lipgloss.Color("230")) - filterInfoStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("246")) + selectedEntryStyle = lipgloss.NewStyle().Background(colorSelected).Foreground(colorSelectedFg) + activeEntryStyle = lipgloss.NewStyle().Bold(true).Foreground(colorTimerText) + selectedActiveEntryStyle = lipgloss.NewStyle().Background(colorWarning).Foreground(colorSelectedFg) + descriptionStyle = lipgloss.NewStyle().Foreground(colorDimmed) + activeDescriptionStyle = lipgloss.NewStyle().Background(colorSelected).Foreground(colorSelectedFg) + filterInfoStyle = lipgloss.NewStyle().Foreground(colorDimmed) ) // renderSummaryView renders the summary view (level 1) with date headers and client/project summaries func (m HistoryBoxModel) renderSummaryView(timer TimerBoxModel, clients []queries.Client, projects map[int64][]queries.Project) string { - content := titleStyle.Render("📝 Recent History") + content := titleStyle.Render("History") if len(m.summaryItems) > 0 { filterInfo := m.formatFilterInfo(clients, projects, timer) - content += "\n\n" + filterInfoStyle.Render(filterInfo) + content += " " + filterInfoStyle.Render(filterInfo) } var activeKey HistorySummaryKey @@ -292,19 +288,15 @@ func (m HistoryBoxModel) renderSummaryView(timer TimerBoxModel, clients []querie } if len(m.summaryItems) == 0 { - return "\n\nNo recent entries found." + return content + "\n\n" + filterInfoStyle.Render("No entries found.") } var date *time.Time for i, item := range m.summaryItems { if date == nil || !date.Equal(item.Date) { date = &item.Date - content += fmt.Sprintf("\n\n%s\n", dateStyle.Render(date.Format("Mon 01/02"))) - } - - style := summaryItemStyle - if m.summarySelection == i { - style = selectedItemStyle + content += "\n" + content += fmt.Sprintf("\n%s", dateStyle.Render(date.Format("Mon Jan 02"))) } dur := item.TotalDuration @@ -312,8 +304,16 @@ func (m HistoryBoxModel) renderSummaryView(timer TimerBoxModel, clients []querie dur += timer.currentTime.Sub(timer.timerInfo.StartTime) } - line := fmt.Sprintf(" %s (%s)", m.formatSummaryTitle(item), FormatDuration(dur)) - content += fmt.Sprintf("\n%s", style.Render(line)) + title := m.formatSummaryTitle(item) + durStr := FormatDuration(dur) + + if m.summarySelection == i { + line := fmt.Sprintf(" %s %s", title, durStr) + content += "\n" + selectedItemStyle.Render(line) + } else { + line := fmt.Sprintf(" %s ", title) + content += "\n" + summaryItemStyle.Render(line) + durationStyle.Render(durStr) + } } return content @@ -338,12 +338,13 @@ func (m HistoryBoxModel) selectedEntries() []queries.TimeEntry { func (m HistoryBoxModel) renderDetailsView(timer TimerBoxModel) string { summary := m.summaryItems[m.summarySelection] clientProject := m.formatSummaryTitle(summary) - date := summary.Date.Format("Mon 01/02") - content := titleStyle.Render(fmt.Sprintf("📝 %s on %s", clientProject, date)) + "\n\n" + date := summary.Date.Format("Mon Jan 02") + content := titleStyle.Render(clientProject) + + filterInfoStyle.Render(" "+date) + "\n\n" entries := m.selectedEntries() if len(entries) == 0 { - return "No entries found for this selection." + return content + filterInfoStyle.Render("No entries found.") } for i, entry := range entries { @@ -363,7 +364,7 @@ func (m HistoryBoxModel) renderDetailsView(timer TimerBoxModel) string { timeRange = fmt.Sprintf("%s - now", startTime) } - entryLine := fmt.Sprintf("%s (%s)", timeRange, FormatDuration(duration)) + durStr := FormatDuration(duration) var style lipgloss.Style if m.detailSelection == i { @@ -380,14 +381,20 @@ func (m HistoryBoxModel) renderDetailsView(timer TimerBoxModel) string { } } - content += style.Render(entryLine) - - descStyle := descriptionStyle if m.detailSelection == i { - descStyle = activeDescriptionStyle + entryLine := fmt.Sprintf(" %s %s", timeRange, durStr) + content += style.Render(entryLine) + } else { + content += style.Render(fmt.Sprintf(" %s ", timeRange)) + content += durationStyle.Render(durStr) } + if entry.Description.Valid { - content += descStyle.Render(fmt.Sprintf(" \"%s\"", entry.Description.String)) + descStyle := descriptionStyle + if m.detailSelection == i { + descStyle = activeDescriptionStyle + } + content += descStyle.Render(" " + entry.Description.String) } content += "\n" -- cgit v1.2.3