Skip to content

feat(graph): overlay prior contribution windows as ghost lines (&ghosts=N) - #8

Merged
chicks-net merged 2 commits into
deployfrom
feat/ghost-lines
Oct 13, 2026
Merged

chicks-net merged 2 commits into
deployfrom
feat/ghost-lines

Conversation

@chicks-net

Copy link
Copy Markdown
Member

Implements chicks-net/chicks-projects#130.

What

Opt-in &ghosts=N URL param (integer 0–6, clamped, default 0) that overlays the N previous contribution windows as faded grey "ghost" lines behind the current line:

  • Semantics — trailing same-length windows: each ghost is the current range shifted back by its own length (31-day graph + ghosts=2 ⇒ current window + the two 31-day windows before it), index-aligned on the X-axis. Works with any days value and custom from/to.
  • Fetching — all windows in one aliased GraphQL request (c0: contributionsCollection(from:$FROM0,to:$TO0){…}, c1: …), so no rate-limit multiplication. Ghosts are trimmed to the current day count by keeping trailing days, front-padded with zero days for windows older than the account, and skipped when they start before GitHub's ~1-year data limit.
  • Chart — ghosts render first (ct-series-ghost, no points/area via Chartist's per-series options) so they paint behind the current window (ct-series-current); area-fill selector migrated accordingly. Fixed grey #9e9e9e @ 35% opacity, thinner stroke, theme-independent, dash-draw animation inherited.
  • Compatibility — ghosts=0 renders the same graph as before (same pixels; markup now uses semantic series classes). /data stays single-window and its response shape is unchanged.

CI

Node.js CI now also runs on PRs to deploy (the branch that auto-deploys). It has never run on this fork before. ⚠️ The repo has no TOKEN secret, so the one live-API test in utils.test.ts self-skips; adding a TOKEN repo secret would enable it.

Verification

  • npm test: 16 passed (13 existing + 3 new), snapshots reviewed and updated — diffs are exactly the intended class migration + ghost CSS.
  • tsc clean; new/changed files prettier-clean.
  • Ran the server locally and hit the live GitHub API: ghosts=2 renders two grey ghost lines behind the current line; ghosts=9 clamps to 6; custom from/to + ghosts works; ghosts=0 and /data unchanged.

Refs chicks-net/chicks-projects#130

Add an opt-in &ghosts=N URL param (0-6, clamped, default 0) that draws
the N previous contribution windows as faded grey "ghost" lines behind
the current one, so the current pace is comparable at a glance.

- fetcher: each ghost window is the current range shifted back by its
  own length; all windows are fetched in ONE aliased GraphQL request
  (c0 = current, c1.. = ghosts), trimmed index-aligned to the current
  day count, front-padded with zero days for short windows, and
  skipped entirely when they start before GitHub's ~1-year data limit
- chart: ghosts render first (SVG paints in document order, so they
  sit behind) as ct-series-ghost with no points or area; the current
  window is now always ct-series-current, and the area fill selector
  migrated accordingly
- styling: fixed grey (#9e9e9e, 35% opacity, thinner stroke) regardless
  of theme; dash-draw animation inherited
- /data stays single-window; ghosts=0 renders the same graph as before

Refs chicks-net/chicks-projects#130
deploy is the branch that auto-deploys to the DO App Platform, so its
PRs are exactly where the test suite should run; previously CI only
watched main, and every PR that merged to deploy shipped untested.

The live-API test in utils.test.ts is skipped when TOKEN is unset, so
CI is green without repo secrets; adding the TOKEN secret enables it.
@chicks-net
chicks-net merged commit 6842a1b into deploy Oct 13, 2026
2 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