Skip to content

feat: add user insights dashboard section#4

Merged
jordangarrison merged 16 commits intomainfrom
user-insights
Feb 24, 2026
Merged

feat: add user insights dashboard section#4
jordangarrison merged 16 commits intomainfrom
user-insights

Conversation

@jordangarrison
Copy link
Copy Markdown
Owner

@jordangarrison jordangarrison commented Feb 19, 2026

Summary

  • User insights section on the dashboard showing authenticated user profile and recent activity
    • User profile bar with avatar, username, and display name
    • 5 most recent PRs with repo, title, state, number, and relative time
    • 5 most recent commits with repo, message, short SHA, and relative time
    • Loading skeleton with pulse animation (only shown on first load)
  • Background caching via UserInsightsServer GenServer
    • Polls GitHub every 5 minutes for fresh data
    • Caches results in ETS for instant dashboard renders
    • Broadcasts updates via PubSub so open dashboards update live
  • Internal navigation — PR and commit links navigate to Greenlight pipeline views (/repos/:owner/:repo/pull/:number, /repos/:owner/:repo/commit/:sha) instead of GitHub
  • Docker image build verification — added nix build .#dockerImage to mix precommit alias
  • Dashboard screenshot added to README

Changes

Feature

  • lib/greenlight/github/user_insights_server.ex — New GenServer: polls user profile + activity, caches in ETS, broadcasts via PubSub
  • lib/greenlight/cache.ex — ETS-backed cache module with idempotent init
  • lib/greenlight/github/client.ex — Added get_authenticated_user/0, search_user_prs/1, search_user_commits/1
  • lib/greenlight/time_helpers.ex — Relative time formatting
  • lib/greenlight_web/live/dashboard_live.ex — Reads cache on mount, subscribes for PubSub updates, internal Greenlight navigation links
  • lib/greenlight/application.ex — ETS cache init + UserInsightsServer in supervision tree

Verification & Docs

  • mix.exs — Added nix build .#dockerImage to precommit alias
  • nix/package.nix — Updated stale npmDepsHash for @xyflow/svelte 1.5.1
  • README.md — Added dashboard screenshot
  • docs/assets/greenlight-dashboard.png — Dashboard screenshot

Tests

  • test/ — Full coverage including PubSub update test (57 tests)

Test plan

  • get_authenticated_user/0 returns user profile from /user endpoint
  • search_user_prs/1 returns PRs from GitHub Search API
  • search_user_commits/1 returns commits with message truncation
  • relative_time/1 formats timestamps correctly
  • Dashboard renders cached user data instantly on mount
  • Dashboard updates when receiving PubSub broadcast
  • PR links navigate to /repos/:owner/:repo/pull/:number
  • Commit links navigate to /repos/:owner/:repo/commit/:sha
  • All 57 tests pass via mix test

Add Greenlight.TimeHelpers module that converts ISO 8601 timestamp
strings to human-readable relative time strings (e.g. "5m ago",
"2h ago", "2d ago"). This will be used by the dashboard template
to display when PRs were updated and when commits were authored.
# Conflicts:
#	lib/greenlight_web/live/dashboard_live.ex
…screenshot

Add `nix build .#dockerImage` to the `mix precommit` alias so docker
image builds are verified locally before finishing feature work. Also
add a dashboard screenshot to the README.
… links

- Add UserInsightsServer GenServer that polls GitHub every 5 min and
  caches user profile, PRs, and commits via ETS
- Dashboard reads from cache on mount for instant render and subscribes
  via PubSub for live updates
- Fix PR and commit links to navigate to Greenlight routes instead of
  GitHub URLs
- Add ETS-backed Cache module to application supervision tree
@jordangarrison jordangarrison merged commit 4f233cc into main Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant