Consolidate duplicate formatAge functions in feed TUI (gt-798p0)

This commit is contained in:
gastown/crew/joe
2025-12-30 23:24:03 -08:00
committed by Steve Yegge
parent 4178940d39
commit f464f87d5b
2 changed files with 2 additions and 15 deletions

View File

@@ -305,7 +305,7 @@ func renderConvoyLine(c Convoy, landed bool) string {
if landed {
// Show checkmark and time since landing
age := formatConvoyAge(time.Since(c.ClosedAt))
age := formatAge(time.Since(c.ClosedAt))
status := ConvoyLandedStyle.Render("✓") + " " + ConvoyAgeStyle.Render(age+" ago")
return fmt.Sprintf(" %s %-20s %s", id, title, status)
}
@@ -337,16 +337,3 @@ func renderProgressBar(completed, total int) string {
return ConvoyProgressStyle.Render(bar)
}
// formatConvoyAge formats duration for convoy display
func formatConvoyAge(d time.Duration) string {
if d < time.Minute {
return "just now"
}
if d < time.Hour {
return fmt.Sprintf("%dm", int(d.Minutes()))
}
if d < 24*time.Hour {
return fmt.Sprintf("%dh", int(d.Hours()))
}
return fmt.Sprintf("%dd", int(d.Hours()/24))
}

View File

@@ -344,7 +344,7 @@ func (m *Model) renderShortHelp() string {
// formatAge formats a duration as a short age string
func formatAge(d time.Duration) string {
if d < time.Minute {
return fmt.Sprintf("%ds", int(d.Seconds()))
return "just now"
}
if d < time.Hour {
return fmt.Sprintf("%dm", int(d.Minutes()))