refactor: remove unused analytics actions and integrate metrics directly
- Deleted `analytics.ts` and `deadline-analytics.ts` as they were no longer needed. - Integrated `AnalyticsService` and `DeadlineAnalyticsService` directly into `HomePage` and `DailyPage`, streamlining data fetching. - Updated components to utilize the new metrics structure, ensuring proper data flow and rendering.
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
'use server';
|
||||
|
||||
import { AnalyticsService, ProductivityMetrics, TimeRange } from '@/services/analytics/analytics';
|
||||
|
||||
export async function getProductivityMetrics(timeRange?: TimeRange): Promise<{
|
||||
success: boolean;
|
||||
data?: ProductivityMetrics;
|
||||
error?: string;
|
||||
}> {
|
||||
try {
|
||||
const metrics = await AnalyticsService.getProductivityMetrics(timeRange);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
data: metrics
|
||||
};
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la récupération des métriques:', error);
|
||||
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur inconnue'
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
'use server';
|
||||
|
||||
import { DeadlineAnalyticsService } from '@/services/analytics/deadline-analytics';
|
||||
|
||||
export async function getDeadlineMetrics() {
|
||||
try {
|
||||
const metrics = await DeadlineAnalyticsService.getDeadlineMetrics();
|
||||
return { success: true, data: metrics };
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la récupération des métriques d\'échéance:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur lors de la récupération des métriques d\'échéance'
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getCriticalDeadlines() {
|
||||
try {
|
||||
const tasks = await DeadlineAnalyticsService.getCriticalDeadlines();
|
||||
return { success: true, data: tasks };
|
||||
} catch (error) {
|
||||
console.error('Erreur lors de la récupération des échéances critiques:', error);
|
||||
return {
|
||||
success: false,
|
||||
error: error instanceof Error ? error.message : 'Erreur lors de la récupération des échéances critiques'
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user