feat(dashboard): add daily trend chart and statistics section to dashboard

- Introduced DailyTrendChart component for visualizing daily scraped TED notices, documents, and translated notices.
- Implemented StatisticsSection to display key metrics with animated counters and a days selector for data range.
- Created utility function to convert API data into labeled points for chart rendering.
- Updated dashboard index to include the new StatisticsSection, enhancing overall dashboard functionality and user experience.
- Refactored existing trends chart to utilize the new DailyPoint type for consistency in data handling.
This commit is contained in:
AmirReza Jamali
2026-06-07 12:39:15 +03:30
parent da1e2f89e7
commit 72948a9b55
21 changed files with 766 additions and 396 deletions
+1
View File
@@ -86,6 +86,7 @@ export const API_ENDPOINTS = {
DASHBOARD: {
SUMMARY: "dashboard/summary",
TREND: "dashboard/trend",
STATISTICS: "dashboard/statistics",
COUNTRIES: "dashboard/countries",
NOTICE_TYPES: "dashboard/notice-types",
CLOSING_SOON: "dashboard/closing-soon",
+13
View File
@@ -5,6 +5,7 @@ import {
TDashboardClosingSoon,
TDashboardCountries,
TDashboardNoticeTypes,
TDashboardStatistics,
TDashboardSummary,
TDashboardTrend,
} from "../types";
@@ -33,6 +34,18 @@ export const dashboardService = {
}
},
statistics: async (params?: {
days?: number;
}): Promise<ApiResponse<TDashboardStatistics>> => {
try {
return (await api.get(API_ENDPOINTS.DASHBOARD.STATISTICS, { params }))
.data;
} catch (error) {
console.error("ERROR caught in Dashboard Service => statistics:", error);
throw error;
}
},
countries: async (params?: {
limit?: number;
}): Promise<ApiResponse<TDashboardCountries>> => {
+18
View File
@@ -21,6 +21,24 @@ export type TDashboardTrend = {
series: TDashboardTrendPoint[];
};
export type TDashboardStatisticsDaily = {
scraped_ted: TDashboardTrendPoint[];
scraped_documents: TDashboardTrendPoint[];
translated_notices: TDashboardTrendPoint[];
};
export type TDashboardStatisticsTotals = {
scraped_documents: number;
translated_tenders: number;
};
export type TDashboardStatistics = {
days: number;
generated_at: number;
daily: TDashboardStatisticsDaily;
totals: TDashboardStatisticsTotals;
};
export type TDashboardCountryItem = {
country_code: string;
count: number;