Skip to content

feat(miner-ui): render Ledgers route through ui-kit StateBoundary + skeletons - #6577

Closed
nghetienhiep wants to merge 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6512
Closed

feat(miner-ui): render Ledgers route through ui-kit StateBoundary + skeletons#6577
nghetienhiep wants to merge 1 commit into
JSONbored:mainfrom
nghetienhiep:fix/issue-6512

Conversation

@nghetienhiep

Copy link
Copy Markdown
Contributor

Summary

Redesigns the miner-ui Ledgers route (apps/loopover-miner-ui/src/routes/ledgers.tsx) to render both of its async flows through the shared @loopover/ui-kit StateBoundary / LoadingState / ErrorState primitives (ported into ui-kit by #6506 / PR #6539) instead of hand-rolled inline JSX, and adopts the previously-unused Skeleton for content-shaped loading placeholders.

  • Ledger-summary read (claims cards, both CountTables, recent-events Table) is wrapped in its own StateBoundary. The plain "Loading local ledgers…" text is replaced by a Skeleton shaped to the eventual card-grid + table layout; the fetch-error branch now renders ui-kit's ErrorState, still surfacing the raw error string. The fresh-install case renders EmptyState with the same "No ledger activity yet" copy.
  • Governor pause/resume read is wrapped in a separate, independent StateBoundary (with its own Skeleton), so a governor-state fetch failure no longer affects the ledger summary below it — and vice-versa (see the two error screenshots).
  • The Governor-control section is restyled from a bare Input+Button row into an organized, bordered panel: a status line with a success/warning state dot, above the input/button group — using only existing @loopover/ui-kit primitives and design tokens (rounded-token, border-border, text-token-sm, text-[var(--success)]/--warning).

The write path is deliberately untouched: lib/ledgers.ts, lib/governor.ts, and the pause/resume Button click handlers (onClick={onResume}, onClick={() => onPause(reason || undefined)}) and the reason Input are byte-for-byte unchanged — only the rendering/layout around them changed, so there remains exactly one write path into the governor.

Closes #6512.

Scope

  • The PR title follows type(scope): short summary Conventional Commit format.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (Closes #6512).

Validation

  • git diff --check
  • npm run typecheck (miner-ui tsc --noEmit) — clean.
  • npm run ui:lint equivalent (eslint . + prettier --check) for miner-ui — no errors; only the pre-existing react-refresh/only-export-components warning shared by every route file.
  • Full miner-ui vitest suite green: 183 passed, coverage 87.89% stmts / 86.86% branch / 81.53% funcs / 89.88% lines, above this app's 85/85/75/85 floor.

Why no codecov/patch check appears: apps/loopover-miner-ui/** is outside src/**, which is the only tree Codecov's patch-coverage gate measures — so the 99%+ branch-counted requirement does not numerically gate this change. Verification is the miner-ui vitest suite (which already has a route test harness — src/ledgers.test.tsx / src/governor.test.tsx, extended here) plus the mandatory screenshots below.

Safety

  • No secrets, wallets, hotkeys, trust scores, or reward values exposed.
  • Public GitHub text stays sanitized and low-noise.
  • No auth/cookie/CORS/session behavior changed (the auth cookie path and the governor write path are untouched).
  • No API/OpenAPI/MCP behavior changed.
  • UI changes use the real empty/error/loading states of the live /api/ledgers and /api/governor/pause-state endpoints — the screenshots below drive those real states (request blocking / 500), no production mock fallback.
  • Visible UI change includes the UI Evidence section below (GitHub-hosted PNG thumbnails).

Tests

Extended the existing route test harness for the new StateBoundary-driven branches of both flows:

  • ledgers.test.tsx — the loading branch now asserts content-shaped Skeleton placeholders (animate-pulse) render and the old plain text is gone; the error branch asserts the ui-kit ErrorState (role="alert") still surfaces the raw error; the empty branch asserts the EmptyState.
  • governor.test.tsx — the governor loading branch likewise asserts the Skeleton (replacing the old "Loading governor state…" text); the existing error/paused/not-paused/pending-disabled tests continue to pass against the restyled panel.

UI Evidence

Both async flows, each shown independently in loading / success / error. The two error shots demonstrate the separate boundaries — one flow can fail while the other renders fully.

State / title JPG/PNG evidence
Ledger summary — loading (skeleton) Ledger summary skeleton loading
Ledger summary — populated (success) Ledger summary populated
Ledger summary — error (/api/ledgers 500) Ledger summary error state
Governor control — loading (skeleton) Governor control skeleton loading
Governor control — restyled panel, not paused Governor control restyled, not paused
Governor control — paused (Resume variant) Governor control paused, resume button
Governor control — error, ledger below unaffected (independent boundaries) Governor error while ledger summary stays populated

Notes

@nghetienhiep
nghetienhiep requested a review from JSONbored as a code owner July 16, 2026 14:51
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 16, 2026
@nghetienhiep
nghetienhiep force-pushed the fix/issue-6512 branch 2 times, most recently from b813450 to 4e5777d Compare July 16, 2026 14:58
@loopover-orb

loopover-orb Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 LoopOver is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed · 🟪 Reviewing

…keletons

Wrap the ledger-summary read and the governor pause/resume read in their own
independent @loopover/ui-kit StateBoundary boundaries, replacing the hand-rolled
plain-text loading/error branches with LoadingState/ErrorState and content-shaped
Skeleton placeholders. Restyle the governor-control section into an organized,
bordered panel using existing ui-kit tokens. The pause/resume write path
(lib/governor.ts, lib/ledgers.ts, the Button click handlers) is untouched.

Closes JSONbored#6512

@JSONbored JSONbored left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Not a fan of the redesign at all, overall the miner app looks...like junk.

@JSONbored JSONbored closed this Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redesign: Ledgers route — StateBoundary + skeletons + governor section restyle

2 participants