Skip to content

feat(action-center): show the first tracking run as one thin line, with Details - #1811

Merged
gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/first-run-strip
Oct 30, 2026
Merged

gkhngyk merged 2 commits into
ansvisor:mainfrom
cihan-gyk:feature/first-run-strip

Conversation

@cihan-gyk

Copy link
Copy Markdown
Collaborator

Summary

From onboarding testing: the first-run panel at the top of the Action Center took several lines while the first tracking run was going. The product owner asked for something simpler and smaller, and approved this design in a local preview.

What changes

  • first-run-note.tsx is one 36px line under the Action Center tabs (Actions, Signals, KPIs, History, Needs review): ⟳ First tracking running · 18 of 40 checks · ~6 min left · Details ▾
    • Details unfolds the old explanation and Follow it on Brand Visibility →, and folds it again.
    • It's gone once the brand has a completed run.
    • Queued runs read "First tracking queued".
  • New hooks/use-first-run.ts: reading the first run (the tracking_runs ledger, or the job this browser saved, with its progress and pace for the time left) moves out of the component. Other parts of the page can now share it; the follow-up PR uses it.
  • en.json: "First analysis" → "First tracking", "~N min left", and details.
  • Docs: help/action-center/action-center-overview.md and docs/guides/action-center.mdx.

Brand Visibility's own progress band (with Stop) is unchanged.

Related issue

None. Product owner's onboarding feedback.

Type of change

  • feat — New feature

How to test

  1. While a brand's first tracking run is going, open Action Center. The line shows under the tabs and Details unfolds and folds it.
    • To preview locally, use a brand with a tracking_runs row from the last 2 hours with no completed_at.
    • The checks count and time left show when this browser started the run, as after a purchase.
  2. yarn vitest run src/components/action-center/first-run-note.test.tsx (13 tests).

Screenshots, light and dark, Details closed and open: shared with the product owner in the local preview and approved.

Checklist

  • Branch follows the naming convention
  • Commits follow Conventional Commits
  • Web: the related tests, prettier/eslint and the Help check pass. Full yarn typecheck ran out of memory locally (8 GB machine), and a typecheck of the changed files and their imports passed. CI runs the full typecheck and build.
  • Tests updated
  • Help article updated

🤖 Generated with Claude Code

…th Details

The panel under the Action Center tabs took several lines while a new
brand's first tracking ran: a title, the count, a link and a paragraph.
People saw it on every section and asked for something simpler and
smaller.

- It is one line now, at most 36px: "First tracking running · 18 of 40
  checks · ~6 min left · Details". Details unfolds what was there before
  (what the run means, or that it waits for a slot, and the way to Brand
  Visibility) and folds it again. Still gone once the brand has a
  completed run.
- The run's reading moves to a hook (hooks/use-first-run.ts): one read
  loop per brand however many parts of the page show the run, so the
  Getting started steps can read the same in the next change. Same
  sources and 12 s pace as before; the time left is kept per brand.
- The count still says checks, not answers: a check can end without an
  answer (ansvisor#1774).
- Help (action-center-overview) and the Action Center guide describe the
  line.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mintlify

mintlify Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit f72bcbb.

Approve preview

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, approve. The line is smaller and does the same job. Moving the reads into useFirstRun keeps the old behaviour and adds one read loop per brand.

Checked, fine

  • Progress states, same as main. Queued (saved job waiting/delayed, no ledger row yet) reads "First tracking queued". Running (ledger row, or saved job active) reads "First tracking running", with checks and time left only when this browser saved the job. Done (any completed run) shows nothing and stops reading. A failed job without a ledger row hides the line. A run row with no stamp counts as running for up to 2 hours (getTrackingWindow's ceiling). A failed read keeps the last state until the next one. All of this matches main's FirstRunNote.
  • The shared hook. useSyncExternalStore with one Watch per brand: the first subscriber starts the loop, and the last unsubscribe stops the timer and drops the entry. A read still in flight returns on !watch.live, so a brand switch or a StrictMode remount never writes into a dead watch. run.brandId === brandId keeps another brand's run off this one. The new "reads once for every line" test covers the shared loop.
  • Polling cost. Unchanged per page: one getTrackingWindow (3 small tracking_runs reads) plus, when this browser saved the job, one getJobStatus every 12 s. With the shared loop, more readers no longer mean more reads.
  • Demo brand / read-only. Reads only, no writes, so the read-only gate doesn't apply. The demo brand has completed tracking_runs rows, so the line never shows there.
  • Details toggle. It's a real <button type="button"> with aria-expanded and aria-controls. The chevron is aria-hidden. The default focus outline stays. The link moves into the unfolded part.
  • Build. The changes are client-only. The hook imports the same modules the component did ('use server' actions, tracking-job-store, tracking-eta). plan-row.test.ts passes.

Non-blocking

  1. Narrow screens. The line is h-9 + truncate, so on a phone "· 18 of 40 checks · ~6 min left" is cut, and Details doesn't repeat it. Letting it wrap below sm (min-h-9, no truncate) or repeating the count in Details would fix that.
  2. Live region. role="status" wraps the whole line, so screen readers hear the count every 12 s, and they hear the Details text when it unfolds. Putting role="status" on the text <p> only would quiet the Details part. The count updates come from main.
  3. Reads with nothing going on. Main does this too: a brand with no completed run and nothing running (never tracked, or a run that failed before the ledger row) keeps reading every 12 s while the page is open, even in a hidden tab. Now that the hook is meant to be shared (#1814 uses it on more pages), it's worth pausing while document.hidden and backing off after a few empty reads.
  4. Copy. queuedBody still says "Another analysis is running right now". "Another tracking run…" would match the rename. The help article says the line shows the checks and time left, but they only show in the browser that started the run (as the PR description says). "when available" would cover it.
  5. The test finds the line through .h-9. A data-testid or role query would survive a style change.

Merge

  • Based on current main and merges clean. No migrations.
  • #1814 is stacked on this PR (its branch contains 8e5e6d6), so no conflict. Merge this one first.
  • Clean with #1810 and #1799. They touch no shared files.

Tests

  • src/components/action-center and src/lib/guards/plan-row.test.ts: 19 files, 156 tests pass.
  • tsc is clean. eslint and prettier are clean on the changed files.

@gkhngyk gkhngyk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Merging in order with the other approved PRs. This head merges current main; its tree is what main will be after this squash, checked with the full server and web suites, tsc, lint, format and next build.

@gkhngyk
gkhngyk merged commit a300967 into ansvisor:main Oct 30, 2026
5 of 6 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.

2 participants