Repository navigation
feat: admin console (document verification, users, audit log) + query cache tuning and Lighthouse CI (#685, #714, #715, #716) - #820
Merged
amina69 merged 3 commits intoOct 26, 2026
Conversation
…he tuning with Lighthouse CI Closes amina69#685, amina69#714, amina69#715, amina69#716
|
@Hollujay is attempting to deploy a commit to the sheriffamina1-9497's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@lockoabosede8-byte 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! 🚀 |
Owner
|
@lockoabosede8-byte kindly fix the conflict |
Resolve import conflicts in App.tsx and ApprovalHistoryTab.tsx by keeping both the admin console / STALE_TIME imports and upstream's new imports.
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.
Summary
Delivers four Phase 3 backlog items in one PR: the query-cache/Lighthouse performance work and the three admin console pages.
Closes #685
Closes #714
Closes #715
Closes #716
#685 — Query cache tuning and Lighthouse budget
src/lib/staleTime.ts: one documentedSTALE_TIMEpolicy per domain: pets 5 min, approvals 1 min, notifications live (0), documents refetch on focus, timelines 30 s, disputes 15 s.staleTimefrom that table and carries a one-line comment justifying it (useApprovalList/Detail,useNotifications,useUnreadNotificationCount,useDisputes/Detail,usePendingApprovalsCount,useEscrowStatus,useAdoptionTimeline,useEscrowTimeline,useCustody*,useSettlementSummary,useNotificationPreferences,usePolling, document and approval-history queries, the notification dropdown).PetCardcallsprefetchPetDetail(id)on mouse-enter and focus (src/lib/prefetchPet.ts,petService.getPet), so detail opens from cache. Prefetch is best-effort and never throws.lighthouserc.jsplus.github/workflows/lighthouse.ymlrun on every PR against the production build and fail if mobile performance < 85 or LCP >= 2.5 s on/listings.#714 — Document verification queue (
/admin/documents)DocumentVerificationPageshows the queue of pending documents inDocumentPreviewModalwith Verify and Reject. Reject reusesRejectionReasonModal, so a reason is required and is stored as the document'srejectionReasonfor the uploader.useVerifyDocumentfetches the queue and exposesdecide. On success the decided document is removed from the cache immediately, so the next document loads automatically.isTypingTargetand the open reject dialog both suppress them, so they never fire while a text field is focused.#715 — User management (
/admin/users)useDebouncedValue, 300 ms).UserDetailDrawershows profile, role, activity counts and recent disputes. Actions:#716 — Audit log viewer (
/admin/audit-log)DateRangePicker); each row expands to the formatted metadata JSON.<script>is inert text.src/utils/csv.tsneutralises cells starting with=,+,-,@(and tab/CR) with a leading', and quotes per RFC 4180.Supporting additions
Admin pages are wrapped in
AdminOnly(access-denied for non-admins). The issues depend on components that don't exist in this repo yet (DateRangePicker,DocumentPreviewModal, debounce), so minimal versions are included.ConfirmationModalserves as the confirm dialog. New API surface lives insrc/api/adminService.tsanddocumentService.getPendingDocuments.Backend contract assumed
GET /documents?status=pending,GET /admin/users?search=,GET /admin/users/:id,POST /admin/users/:id/suspend {reason},POST /admin/users/:id/reinstate,PATCH /admin/users/:id/role {role},GET /admin/audit-log?actor&action&from&to. Please confirm these against the backend; they're isolated in two service files. The current user's id is read fromlocalStorage["petad_user_id"]for the self-role check.Testing
src/pages/admin/__tests__andsrc/utils/__tests__covering each acceptance criterion (inert<script>, CSV neutralisation, shortcuts not firing while typing, auto-advance, self-role disabled with tooltip, suspension requires a reason, role confirmation names the target).tsc -bandeslint srcare clean.mockNotificationStream.test.ts("emits a well-formed envelope…"), which also fails on unmodifiedmainand is unrelated.