Skip to content

[codex] show credit period totals#2251

Merged
riderx merged 1 commit into
mainfrom
codex/admin-credit-period-totals
May 12, 2026
Merged

[codex] show credit period totals#2251
riderx merged 1 commit into
mainfrom
codex/admin-credit-period-totals

Conversation

@riderx
Copy link
Copy Markdown
Member

@riderx riderx commented May 12, 2026

Summary (AI generated)

  • Added selected-period total cards for credits bought and credits used on the admin credits dashboard.
  • Reused the existing admin global stats trend data, so no new API or database path is introduced.

Motivation (AI generated)

Admins can already see credit bought/used charts, but they need the period totals at a glance for the active dashboard date range.

Business Impact (AI generated)

This makes credit usage and sales monitoring faster for support and operations, improving visibility into credit revenue and consumption without changing customer-facing behavior.

Test Plan (AI generated)

  • bun lint
  • bun typecheck
  • bun run build
  • Headless local browser smoke check for /admin/dashboard/credits redirect/runtime errors
  • bun test:front

Summary by CodeRabbit

Release Notes

  • New Features
    • Added period-level credit statistics cards to the Admin Credits dashboard for better visibility of credit consumption
    • New cards display aggregate totals for credits purchased and consumed within the selected date range
    • Includes date range indicator subtitle and properly formatted credit values with loading state support for enhanced user experience

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d3ac29b-6730-4024-a176-c8e4557ce4ac

📥 Commits

Reviewing files that changed from the base of the PR and between 2df4ebb and d2e0833.

📒 Files selected for processing (2)
  • messages/en.json
  • src/pages/admin/dashboard/credits.vue

📝 Walkthrough

Walkthrough

This PR adds period-level credit summary cards to the admin dashboard. New translation keys support UI labels, a computed property aggregates credit trend data into bought and consumed totals, and a responsive card grid displays these metrics with loading states.

Changes

Admin Credits Period Totals

Layer / File(s) Summary
Messages and component setup
messages/en.json, src/pages/admin/dashboard/credits.vue
Three new translation keys (admin-credits-period-total-bought, admin-credits-period-total-subtitle, admin-credits-period-total-used) are added; AdminStatsCard component is imported.
Period totals calculation and display
src/pages/admin/dashboard/credits.vue
periodCreditTotals computed property reduces globalStatsTrendData to sum creditsBought and creditsConsumed for the active period; a two-card grid renders these totals using AdminStatsCard with loading state and formatted values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • Cap-go/capgo#2245: Fixes how the admin "global stats trend" data is fetched and surfaced, which the frontend UI in this PR depends on.
  • Cap-go/capgo#2217: Corrects the backend SQL query producing global_stats_trend, ensuring the aggregated data consumed by this PR's computed property is accurate.

Poem

🐰 A dashboard blooms with credit cards divine,
Totals bought and spent now brightly shine,
From trend data springs a computed delight,
Period summaries dance in the admin's sight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title '[codex] show credit period totals' clearly summarizes the main change: adding period total cards to the admin credits dashboard.
Description check ✅ Passed The description includes summary, motivation, business impact, and a comprehensive test plan covering linting, typechecking, build verification, and manual testing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/admin-credit-period-totals

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

@codspeed-hq
Copy link
Copy Markdown
Contributor

codspeed-hq Bot commented May 12, 2026

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing codex/admin-credit-period-totals (d2e0833) with main (2df4ebb)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@sonarqubecloud
Copy link
Copy Markdown

@riderx riderx marked this pull request as ready for review May 12, 2026 21:23
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@riderx riderx merged commit a03601d into main May 12, 2026
40 checks passed
@riderx riderx deleted the codex/admin-credit-period-totals branch May 12, 2026 21:29
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.

1 participant