Open
Conversation
…x | split up huge components into multi files
…stats after performance increases
4 tasks
iamsrijan724
approved these changes
Feb 28, 2026
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.
Overview
This PR delivers the full data dashboard implementation across all three user roles (Admin, Nonprofit, Supplier), refactors page components into maintainable hooks and sub-components
What Changed
New Chart Components (
src/components/charts/)Five reusable chart components built on Recharts and wired into all three dashboards:
BarChartComponent.tsx— horizontal and vertical bar charts with pagination supportLineChartComponent.tsx— time-series line chartsAreaChartComponent.tsx— area/fill chartsDonutChart.tsx— donut/pie breakdown chartsKPICard.tsx— metric summary cards with icon supportAnalytics API Routes (
src/app/api/analytics/)new endpoints for the dashboards, and they have test cases
/api/analytics/system-health/api/analytics/product-distribution/api/analytics/product-status-trends/api/analytics/supplier-activity/api/analytics/supplier-metrics/api/analytics/nonprofit-engagement/api/analytics/nonprofit-metrics/api/analytics/claims-over-timeAdmin Dashboard(
src/app/admin/)admin/page.tsx, It has been split into:Components:
_components/OverviewTab.tsx— KPI cards + all chart grid_components/NonprofitsTab.tsx— Nonprofit approval management_components/SuppliersTab.tsx— Supplier listing_components/ProductRequestsTab.tsx— Product request table_components/TabNav.tsx— Tab navigation barHooks:
_hooks/useAdminData.ts— Data fetching for suppliers, nonprofits, products, documents_hooks/useAdminAnalytics.ts— Analytics data fetching and aggregation_hooks/useApproval.ts— Nonprofit approval/rejection logicTypes:
_types/index.ts— Shared admin types (AnalyticsData,ApprovalMode,AdminNonprofitDocument)New Confirmation Modal:
src/components/Admin/ApprovalConfirmationPopup.tsx— Reusable approval/rejection confirmation dialogNonprofit Dashboard (
src/app/nonprofit/)nonprofit/page.tsx, Its Split into:Components:
_components/OverviewTab.tsx— Metrics overview with charts_components/AvailableProductsTab.tsx— Browse and claim available products_components/ClaimsTab.tsx— View and unclaim existing claims_components/TabNav.tsx— Tab navigationHooks:
_hooks/useNonprofitData.ts— Fetches nonprofit, products, and interests data_hooks/useNonprofitMetrics.ts— Fetches per-nonprofit analytics_hooks/useClaim.ts— Claim and unclaim product logicTypes:
_types/index.ts— Shared nonprofit typesNew Confirmation Modal:
src/components/Nonprofit/ClaimConfirmationPopup.tsx— Claim/unclaim confirmation dialogSupplier Dashboard (
src/app/supplier/)supplier/page.tsx, Its Split into:Components:
_components/OverviewTab.tsx— Supplier metrics with charts_components/ProductsTab.tsx— Product listing with pickup info_components/ProductDetailsInputs.tsx— Product creation/edit form fields_components/TabNav.tsx— Tab navigationHooks:
_hooks/useSupplierData.ts— Fetches supplier and product data_hooks/useSupplierMetrics.ts— Fetches per-supplier analytics_hooks/useSupplierForm.ts— Product form state and submission logicTypes:
_types/index.ts— Shared supplier types