Skip to content

feat: add admin search analytics page with stubbed backend (#326) - #440

Open
ojuotimi932 wants to merge 3 commits into
Deen-Bridge:mainfrom
ojuotimi932:feature/search-analytics-326
Open

feat: add admin search analytics page with stubbed backend (#326)#440
ojuotimi932 wants to merge 3 commits into
Deen-Bridge:mainfrom
ojuotimi932:feature/search-analytics-326

Conversation

@ojuotimi932

@ojuotimi932 ojuotimi932 commented Aug 27, 2026

Copy link
Copy Markdown

Closes #326

Add the search analytics dashboard page showing query volume trends, click-through rates, top queries table, and zero-result content gap signals. Backend action is stubbed with tracked:false placeholders until analytics endpoints ship. Includes service contract and page state tests.

🤖 Generated with Codebuff

Summary by CodeRabbit

  • New Features

    • Added an admin Search Analytics page with selectable date ranges.
    • Added summary metrics for queries, unique searches, zero-result searches, and click-through rate.
    • Added weekly trend charts and tables for popular and zero-result queries.
    • Added clear loading, error, no-data, and “not tracked yet” states.
  • Tests

    • Added coverage for analytics loading, rendering, date ranges, trends, empty states, and service errors.

…ge#326)

Add the search analytics dashboard page showing query volume trends,
click-through rates, top queries table, and zero-result content gap
signals. Backend action is stubbed with tracked:false placeholders
until analytics endpoints ship. Includes service contract and page
state tests.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Aug 27, 2026

Copy link
Copy Markdown

@ojuotimi932 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

@vercel

vercel Bot commented Aug 27, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Deen Bridge Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

Next included review available in 3 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 74cab068-1b82-41ca-8549-67085857f151

📥 Commits

Reviewing files that changed from the base of the PR and between dc2b028 and 8ba48d3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • app/[locale]/admin/audit-logs/page.jsx
  • app/[locale]/admin/reconciliation/page.jsx
  • app/[locale]/admin/reports/page.jsx
  • components/admin/GlobalTransactionExplorer.jsx
  • lib/admin/messages/common.js
  • lighthouserc.json

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a4c360c4-9a99-45d2-955b-74f918bfe10d

📥 Commits

Reviewing files that changed from the base of the PR and between 45819f7 and dc2b028.

📒 Files selected for processing (4)
  • __tests__/admin/SearchAnalyticsPage.test.jsx
  • __tests__/admin/admin-search-analytics.service.test.js
  • app/[locale]/admin/analytics/search/page.jsx
  • lib/actions/admin-search-analytics.js

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The change adds a client-side admin search analytics page. A stubbed action returns a typed analytics snapshot with date ranges, metrics, query lists, and weekly trends. Tests cover the service contract and page states.

Changes

Search analytics

Layer / File(s) Summary
Analytics response contract
lib/actions/admin-search-analytics.js, __tests__/admin/admin-search-analytics.service.test.js
Adds fetchSearchAnalytics with date-range handling, four tracked metrics, empty query arrays, and weekly trend placeholders. Contract tests validate the response fields and default range.
Admin analytics page
app/[locale]/admin/analytics/search/page.jsx
Adds date-range selection, asynchronous loading with stale-update protection, metric cards, charts, query tables, trend badges, loading skeletons, and error states.
Analytics UI validation
__tests__/admin/SearchAnalyticsPage.test.jsx
Adds Vitest coverage for loading, successful rendering, untracked metrics, populated tables, weekly trends, and service errors.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: 🔵 Low · up to dc2b0

The new admin analytics page currently shows only placeholder data, so immediate user or production impact is limited; however, the route and analytics service lack an enforced administrator authorization boundary, so owner follow-up is required before real analytics are connected.

Sequence Diagram(s)

sequenceDiagram
  participant Admin
  participant SearchAnalyticsPage
  participant fetchSearchAnalytics
  participant AnalyticsView
  Admin->>SearchAnalyticsPage: choose time range
  SearchAnalyticsPage->>fetchSearchAnalytics: request analytics date range
  fetchSearchAnalytics-->>SearchAnalyticsPage: return analytics snapshot
  SearchAnalyticsPage->>AnalyticsView: render metrics, charts, and tables
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: an admin search analytics page with a stubbed backend.
Linked Issues check ✅ Passed The PR implements the search analytics page, top-query and zero-result tables, trend visualizations, date-range selection, and the aggregation contract. The stubbed backend supports the contract and i…
Out of Scope Changes check ✅ Passed All changes are related to search analytics. The page, backend action, service contract tests, and page state tests support the linked issue objectives.
Full details: Linked Issues check

Explanation

The PR implements the search analytics page, top-query and zero-result tables, trend visualizations, date-range selection, and the aggregation contract. The stubbed backend supports the contract and intentional tracked-state placeholders described in the PR objectives.

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

tewulogb and others added 2 commits August 27, 2026 14:02
Fix duplicate/corrupted JSX structures from bad merges in:
- audit-logs: removed duplicate table headers, loading states, and pagination buttons
- reconciliation: removed duplicate button block and duplicate tx.txHash section
- reports: removed duplicate table headers, loading states, and dropdown menus

Also fix missing semicolon in lib/admin/messages/common.js (unescaped quotes).

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
- Fix lighthouserc.json: change urlList → url for lighthouse-ci
- Fix a11y label/control associations in audit-logs, reconciliation,
  GlobalTransactionExplorer (add htmlFor + id)
- Add role/tabIndex/onKeyDown to clickable div in reports page
- Regenerate package-lock.json to resolve dependency mismatches

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@zeemscript

Copy link
Copy Markdown
Collaborator

Strict review blocker: Lint and Build and Vercel are failing. Please fix the failing checks before requesting merge.

@zeemscript

Copy link
Copy Markdown
Collaborator

Strict review blocker: required CI checks are failing. Please fix them before requesting merge.

@zeemscript

Copy link
Copy Markdown
Collaborator

Strict review blocker: and are failing. Please fix the failing checks before requesting merge.

@zeemscript

Copy link
Copy Markdown
Collaborator

@ojuotimi932 this PR has merge conflicts with the main branch. Please resolve the conflicts (merge main in or rebase) and push the fix so it can be merged. Thanks!

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.

[Enhancement] Search analytics (what users look for)

2 participants