activity

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package activity provides last-activity tracking and color-coding for the dashboard.

Index

Constants

View Source
const (
	ColorGreen   = "green"   // Active: <2 minutes
	ColorYellow  = "yellow"  // Stale: 2-5 minutes
	ColorRed     = "red"     // Stuck: >5 minutes
	ColorUnknown = "unknown" // No activity data
)

Color class constants for activity status.

View Source
const (
	ThresholdActive = 2 * time.Minute // Green threshold
	ThresholdStale  = 5 * time.Minute // Yellow threshold (beyond this is red)
)

Thresholds for activity color coding.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	LastActivity time.Time     // Raw timestamp of last activity
	Duration     time.Duration // Time since last activity
	FormattedAge string        // Human-readable age (e.g., "2m", "1h")
	ColorClass   string        // CSS class for coloring (green, yellow, red, unknown)
}

Info holds activity information for display.

func Calculate

func Calculate(lastActivity time.Time) Info

Calculate computes activity info from a last-activity timestamp. Returns color-coded info based on thresholds:

  • Green: <2 minutes (active)
  • Yellow: 2-5 minutes (stale)
  • Red: >5 minutes (stuck)
  • Unknown: zero time value

func (Info) IsActive

func (i Info) IsActive() bool

IsActive returns true if the activity is within the active threshold (green).

func (Info) IsStale

func (i Info) IsStale() bool

IsStale returns true if the activity is in the stale range (yellow).

func (Info) IsStuck

func (i Info) IsStuck() bool

IsStuck returns true if the activity is beyond the stale threshold (red).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL