Task 5.25: Dashboard-System — GET /api/v1/dashboard/widgets, DashboardWidgetLoader, DashboardGrid with drag-and-drop, 3 example widgets (RecentContacts, TasksSummary, CalendarUpcoming), updated Dashboard.tsx, i18n, 6 tests

This commit is contained in:
Agent Zero
2026-07-24 00:09:26 +02:00
parent 96e183bab2
commit 036e87a9ed
15 changed files with 544 additions and 6 deletions
+33
View File
@@ -0,0 +1,33 @@
/**
* Dashboard API hooks (Task 5.25).
*/
import { useQuery } from '@tanstack/react-query';
import { apiGet } from './client';
export interface DashboardWidgetDef {
id: string;
label_key: string;
label: string;
component: string;
icon: string;
order: number;
col_span: number;
row_span: number;
permission: string;
plugin_name: string;
}
export interface DashboardWidgetsResponse {
items: DashboardWidgetDef[];
total: number;
}
export function useDashboardWidgets() {
return useQuery({
queryKey: ['dashboardWidgets'],
queryFn: () =>
apiGet<DashboardWidgetsResponse>('/dashboard/widgets'),
staleTime: 60 * 1000,
});
}