Skip to content

feat(web): add CSV export for reputation rankings in admin dashboard (closes #5) - #6

Open
guptakumarranjeet150 wants to merge 1 commit into
MDTechLabs:mainfrom
guptakumarranjeet150:feature/admin-export-csv
Open

guptakumarranjeet150 wants to merge 1 commit into
MDTechLabs:mainfrom
guptakumarranjeet150:feature/admin-export-csv

Conversation

@guptakumarranjeet150

@guptakumarranjeet150 guptakumarranjeet150 commented Sep 13, 2026 •

Copy link
Copy Markdown

Summary of Changes

This PR implements the Export-to-CSV feature for reputation rankings on the admin dashboard, fulfilling all requirements specified in #5.

Key Implementations:

  1. Shared Types (packages/types):

    • ReputationRanking: Standard model capturing contributor ranking, TrustScore, PRs merged, governance votes, and Drips stream allocations.
    • MonthlyReputationData: Aggregated DAO monthly rankings container.
    • CsvExportOptions: Configurable export options (toggle addresses, detailed metric breakdowns).
  2. RFC-4180 Compliant CSV Generation (apps/web/src/utils/csvExport.ts):

    • generateReputationCsv(): Generates properly formatted and escaped CSV data.
    • escapeCsvField(): Adheres strictly to RFC-4180 rules (doubling internal quotes, wrapping values with commas/quotes/newlines).
    • generateMonthlyCsvFilename(): Sanitizes DAO names and periods (e.g. trustgraph_reputation_steward_dao_2026-09.csv).
    • triggerCsvDownload(): Cross-browser Blob download trigger.
  3. Admin Dashboard Component (apps/web/src/components/AdminDashboard.tsx):

    • High-contrast, accessible UI displaying summary metrics (Total Contributors, Average TrustScore, PRs, Votes).
    • Evaluation Period selector (defaults to current month).
    • Instant Export-to-CSV button with download feedback toast.
    • Interactive options to toggle wallet address and detailed breakdown columns.
  4. Comprehensive Test Suite:

    • apps/web/src/utils/csvExport.test.ts: 12 unit tests verifying escaping, sorting, option toggles, and edge cases.
    • apps/web/src/components/AdminDashboard.test.tsx: 4 component integration tests verifying render, export trigger, options, and period switching.
    • 16/16 tests pass green; tsc --noEmit typecheck passes with 0 errors.

Closes #5

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.

[Feature] Add Export-to-CSV for Reputation Rankings

1 participant