Skip to content

site: render the "currently tending" indicator from the live-data Worker - #433

Merged
max-sixty merged 2 commits into
mainfrom
tend-activity
May 12, 2026
Merged

max-sixty merged 2 commits into
mainfrom
tend-activity

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

Adds the third live-data element to the marketing site: a "currently tending" indicator in the hero. It fetches api.tend-src.com/currently-tending and shows ● tending owner/repo · review while a tend workflow is running. When nothing is in progress — the common case — it falls back to /activity's newest event as ○ last tended N min ago, per the UI-fallback contract already written into docs/website-data.md. If both requests fail it stays hidden, like the existing stats strip and activity feed.

Also extracts the relative-time formatter (relativeTime) — previously duplicated inside Activity.astro — into site/src/lib/time.ts, now shared by both components.

Files

  • site/src/components/CurrentlyTending.astro — new component (server-rendered hidden <p> + client <script>, same pattern as Stats.astro / Activity.astro)
  • site/src/lib/time.ts — new; relativeTime(iso) shared helper
  • site/src/components/Activity.astro — now imports relativeTime instead of its local copy
  • site/src/pages/index.astro — renders <CurrentlyTending /> after the hero badges
  • site/src/styles/global.css — .now-tending / .now-dot{-live,-idle} + a now-pulse keyframe gated behind prefers-reduced-motion: no-preference
  • site/README.md, docs/website-data.md — doc updates

Test plan

  • npm run build clean; pre-commit run --all-files green
  • Verified in a browser against the production Worker: idle state renders "last tended N min ago"; activity feed still renders after the relativeTime refactor; no console errors
  • The live state (filled moss dot + pulse) wasn't reproduced in-browser — it needs a tend workflow actually running — but the code path is symmetric with the verified idle path

Fetches /currently-tending and, when nothing is in progress, falls back to
/activity's newest event ("last tended N min ago") per the UI-fallback
contract in docs/website-data.md. Sits in the hero below the badges; hidden
only when both requests fail.

Extracts the relative-time formatter shared with Activity.astro into
site/src/lib/time.ts.

Co-Authored-By: Claude <[email protected]>

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One inline suggestion — the hidden attribute is being defeated by the new author rule, so the indicator's top margin leaves a visible gap before (and during outage of) the fetch.

Comment thread site/src/styles/global.css Resolved
The display: flex rule overrode the UA [hidden] { display: none } default,
so the empty <p hidden> kept its top margin and left a visible gap before
the fetch resolved (and permanently if both endpoints failed).

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty merged commit 8fa0c49 into main May 12, 2026
8 checks passed
@max-sixty
max-sixty deleted the tend-activity branch May 12, 2026 03:11
max-sixty added a commit that referenced this pull request May 12, 2026
…ponents (#438)

## Summary

Pure refactor — no behavior change. `Stats.astro`, `Activity.astro`, and
`CurrentlyTending.astro` each carried their own copy of the same
runtime-fetch boilerplate (fetch with `Accept` header, `resp.ok` guard,
`try/catch → bail`, `hidden = false` on success). A prior review on #433
flagged the duplication. This lifts it into `site/src/lib/api.ts`:

- `fetchJson<T>(path): Promise<T | null>` — the fetch wrapper (null on
non-OK / network error). Was `getJson` inside `CurrentlyTending`.
- `liveData<T>(path, sectionId, render)` — looks up
`getElementById(sectionId)`, calls `fetchJson(path)`, hands the parsed
body (or `null` on failure) to `render(data, el)`, and reveals the
element only if `render` returns `true`. `render` owns the DOM and the
"is this worth showing?" decision, and may issue further fetches —
`CurrentlyTending` passes an `async render` that does its `/activity`
fallback this way.

`WORKER_URL` is now module-private to `api.ts` (only `fetchJson` uses
it). Renamed `CurrentlyTending`'s local `render` helper to `paint` so it
doesn't overlap with `liveData`'s `render` parameter. README line
updated.

Net −12 lines; bundles shrink slightly (a shared `api.*.js` chunk
replaces the per-component copies).

## Test plan

- `npm run build` clean; `pre-commit run --all-files` green; `tsc
--noEmit` passes (checked via reviewer)
- Verified in a browser against the production Worker: all three
sections render — saw both `CurrentlyTending`'s live state (`tending
owner/repo · review (+2 more)`) and idle fallback (`last tended N min
ago`), the stat strip, and the 10-row activity feed — no console errors
- Behavior preserved: `CurrentlyTending` still falls back to `/activity`
when `/currently-tending` *fails* (not only when it's empty); each
section still hides in exactly the cases it did before

Co-authored-by: Claude <[email protected]>
max-sixty pushed a commit that referenced this pull request Aug 22, 2026
`global.css`'s header claims the site has "one animation (logo unfurl)".
Neither half is true any more: the logo animations live in `Logo.astro`,
and this file itself defines a second one — `now-pulse`, driving the
currently-tending dot and the activity feed's tending badge. Nightly
survey finding; the header dates from the original site prototype, and
the pulse landed after it.

The comment now names what each file actually holds, so a reader landing
on the header isn't sent looking for a logo animation that was never
here. Comment-only change — no test, nothing to exercise.

<details><summary>Provenance</summary>

- Header introduced in #412 (`2136f21`, 2026-05-10), when
the logo unfurl was the only animation on the site.
- `now-pulse` added later, in #433 and extended in
#463.
- Current keyframes: `now-pulse` at
[`site/src/styles/global.css#L329`](https://github.com/max-sixty/tend/blob/8cf262826adba8d0e1291eb6aa645b52412f56d2/site/src/styles/global.css#L329);
`logo-draw` / `logo-sfade` / `logo-breathe` in
[`site/src/components/Logo.astro`](https://github.com/max-sixty/tend/blob/8cf262826adba8d0e1291eb6aa645b52412f56d2/site/src/components/Logo.astro).

</details>

Co-authored-by: tend-agent <[email protected]>
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.

2 participants