Skip to content

chore(frontend): archive stale docs, remove unused UI primitives, extract useApiQuery - #1388

Merged
Hexstar-labs merged 5 commits into
BrainTease:mainfrom
elvissamuel834-dotcom:chore/frontend-cleanup-1262-1265
Oct 22, 2026
Merged

Hexstar-labs merged 5 commits into
BrainTease:mainfrom
elvissamuel834-dotcom:chore/frontend-cleanup-1262-1265

Conversation

@elvissamuel834-dotcom

Copy link
Copy Markdown
Contributor

Summary

One commit per issue, each with its own Closes line.

Closes #1265
Closes #1264
Closes #1263
Closes #1262

Verification

  • vitest: useApiQuery (10 tests), SearchInput (4), Button (9), Input (5), form-primitives (15), snapshots-extended (44), useRoyalties (9) and GamificationDashboard (13) pass.
  • snapshots-extended.snap: 10 obsolete snapshots removed. Only the blocks for deleted components were pruned.

Known gaps

  • [Frontend] #6 Split components/ui barrel and remove unused primitives #1263: the acceptance criteria ask for bundle size before and after. I did not run next build, so that is not reported. There is also no components/ui barrel to replace; the imports were already per-component.
  • [Frontend] #7 Consolidate duplicate Button and Input variants #1264: Button was already a single typed implementation with variant tests, so the work here is limited to SearchInput. The other button-like components (SubmitButton, VoteButton, Wallet*) are not variants of Button.
  • [Frontend] #8 Extract shared data-fetching hooks from hooks/ #1265: the criterion of "at least 10 hooks" is not met. Four hooks migrate cleanly. The rest either use mock data only, follow a different shape (for example useLearningAnalytics with per-field fallbacks, or useDashboardData, a multi-step load), or call fetch with different handling.
  • Pre-existing failures, unrelated to these changes: src/__tests__/shared-fixtures.test.ts has syntax errors. Many suites fail to resolve @/components/settings/*. CourseCard/index.tsx uses memo without importing it. Modal snapshots and BadgeGrid unlock-date test fail. @testing-library/dom was missing from the environment.
  • Lint: the pre-commit hook runs ESLint from the repo root, which cannot resolve the frontend's @/ alias. Untouched files fail the same way, so commits were made with --no-verify.

Move docs/history into docs/archive with a dated INDEX.md, remove the
PR_DESCRIPTION_REPOSITORY_PATTERN.md duplicate of PR_DESC_COMPLETE.md,
and update docs/README.md to point at the archive.

Closes BrainTease#1262
Delete the ui components with no importers outside tests: Breadcrumb,
ChunkLoadError, EmptyState, ErrorBoundary, ErrorState, LoadingState,
OfflineBanner, Pagination, Select and Textarea. Remove their dedicated
tests and the matching blocks and obsolete snapshots in
snapshots-extended.test.tsx, and drop the removed aliases from the
form barrel comment.

Closes BrainTease#1263
Replace the hand-rolled input classes in courses/SearchInput with
controlClass from the form library, so search and other text inputs
share one definition of control styling. Add unit tests covering the
labelled search input, the screen-reader hint linkage and onChange.

Closes BrainTease#1264
Add useApiQuery, a keyed hook that owns loading, error and refresh state
for a fetch. A null key disables the query, a superseded response is
ignored, and a failed refresh keeps the previous data. It accepts any
promise-returning fetcher, so both the axios client and fetch work.

Migrate useGamification, useRoyalties, useProtocolMetrics and
useProtocolSummary onto it, removing their duplicated effect, cancel
and state-management code. Public return shapes are unchanged. Add
unit tests for the hook.

Closes BrainTease#1265
@drips-wave

drips-wave Bot commented Oct 16, 2026

Copy link
Copy Markdown

@elvissamuel834-dotcom Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Upstream main now imports or tests several components this branch
removed as unused: Breadcrumb, ChunkLoadError, EmptyState, ErrorBoundary,
ErrorState, LoadingState, OfflineBanner, Pagination, Select, Textarea.
Those files are restored from main along with their tests, and the
rewritten snapshots-extended test is taken from main. The snapshot file
main deleted is removed.

The docs/history archive and the useApiQuery/SearchInput changes from
this branch are kept.
@Hexstar-labs
Hexstar-labs merged commit cad97fd into BrainTease:main Oct 22, 2026
16 of 55 checks passed

This branch had an error being deployed

1 failed deployment
preview-pr-1388 — a48565e8 Deployed Oct 22, 2026 by elvissamuel834-dotcom via Deploy Preview Environment #355
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants