Conversation
… and boundary layers
… consistent hook and view helper names
…act counts, dates, relative age, safe urls, reason prompts, inbox focus id
…img-element disables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This is the last PR of the admin cleanup train: repo-wide abstractions, naming, performance, and lint and dead-code guardrails.
Abstractions:
flatPageshelper and one invalidation helper.Naming:
useXList,useXListInfinite,useX.features/home.Performance:
Guardrails:
Visible in: admin. A few display formats change; see the copy table.
Before you start
admin.civfix.dev, once Admin test harness and characterization safety net #38 to Admin in-file cleanup: mail, discovery, users, moderation, home, analytics, hosts, pages #45 and this PR have merged to main.Verify
[Admin]
Changed displays:
Unchanged behavior on the new shared code:
7. In every section, type in the search box, pick a row with the mouse and with Enter, click "Load more", switch filters, and follow a deep link from the Dashboard. Expect: the same selection behavior as #45: a deep link wins, a filtered-out pick stays open (Host messaging clears it), and a pick that leaves the list after an action clears.
8. On "Moderation", "Keep" an item. On "Organizations", "Suspend" an org with a reason. Expect: the same toasts, and the "Reason (required)" prompt.
9. On the Dashboard, check the live map, then open a jurisdiction's boundary map. Expect: the tiles, pins and outline render as before.
Regression
Every list and action: [Admin]
Not covered
Findings addressed
lib/infinite.ts(infiniteListOptions,flatPages); query keys and request params are byte-identical.invalidateXhelpers now useinvalidateKeys, with the same keys, order and returned promise.hooks/use-selection.ts, with per-page options.ListStates,LoadMoreButton(inline style replaced by a class),ListCardandSearchBoxproduce identical DOM.components/map/leaflet-base.tsis shared by both maps, and the tile and boundary layers are reused instead of recreated.id.slice(0, 8)), first names, compact counts, dates, the relative-age ladder (sharedrelativeAgo), required-reason prompts, and the inbox focus ID.useOrgsInfinitebecomesuseOrgListInfinite,useAdminOrgbecomesuseOrg, anduseAdminLogoutbecomesuseOperatorLogout.getMailPreviewPresentationbecomesmailPreviewView, andcancelBlockedForbecomescancelBlockedMessage.hooks/use-admin-home.tsmoves tofeatures/home/use-home.ts(a pure rename commit).eslint.config.mjs(flat config through the ESLint CLI) keepsnext/core-web-vitalsandnext/typescript.projectService:no-floating-promises,no-misused-promises(JSX attributes allowed),switch-exhaustiveness-checkandconsistent-type-imports(error). They surfaced no real bugs; 11 mechanical fixes.@next/next/no-img-elementis off (meaningless for a static export with unoptimized images). 25 inline disables and 6 inert array-index disables are removed.knip.config.ts: 11 findings go to 0, with one justified ignore.Decisions for the reviewer
useDiscoveryTaskis kept but unused until the discovery-notes decision. knip is told why.User-visible copy changes
Tests changed
discovery-page.test.tsxandanalytics-page.test.tsx: the compact-number expectations were pinned to the old output ("3899k", "1.2k") and are updated.send-panel.test.ts: the "Already sent" date format is updated.lib/display.test.ts.useSelection(17), the section-list pieces (10),lib/display, the dates variants,invalidateKeysdedupe (including the object-param safety case),useNow, and the row age ticking.Verification
pnpm lint(ESLint CLI),pnpm typecheck,pnpm build,pnpm test(118 files, 1,210 tests, 3 runs),pnpm --filter admin knip(0 findings) andpnpm --filter admin dupall pass.🤖 Generated with Claude Code