feat(#41): implement widget system backend (closes #41)

This commit is contained in:
Jason Woltje
2026-01-29 21:30:01 -06:00
parent 0bd12b5751
commit 532f5a39a0
11 changed files with 927 additions and 6 deletions

View File

@@ -68,7 +68,11 @@ export type WidgetComponentType =
| "TasksWidget"
| "CalendarWidget"
| "QuickCaptureWidget"
| "AgentStatusWidget";
| "AgentStatusWidget"
| "StatCardWidget"
| "ChartWidget"
| "ListWidget"
| "CalendarPreviewWidget";
/**
* Props for individual widgets
@@ -79,3 +83,83 @@ export interface WidgetProps {
onEdit?: () => void;
onRemove?: () => void;
}
/**
* Widget configuration types
*/
export interface StatCardConfig {
title?: string;
dataSource: "tasks" | "events" | "projects";
metric: "count" | "completed" | "overdue" | "upcoming";
filter?: Record<string, unknown>;
color?: string;
icon?: string;
}
export interface ChartConfig {
title?: string;
chartType: "bar" | "line" | "pie" | "donut";
dataSource: "tasks" | "events" | "projects";
groupBy: "status" | "priority" | "project" | "day" | "week" | "month";
filter?: Record<string, unknown>;
colors?: string[];
}
export interface ListConfig {
title?: string;
dataSource: "tasks" | "events" | "projects";
sortBy?: string;
sortOrder?: "asc" | "desc";
limit?: number;
filter?: Record<string, unknown>;
showStatus?: boolean;
showDueDate?: boolean;
}
export interface CalendarPreviewConfig {
title?: string;
view: "day" | "week" | "agenda";
showTasks?: boolean;
showEvents?: boolean;
daysAhead?: number;
}
/**
* Widget data response types
*/
export interface WidgetStatData {
value: number;
change?: number;
changePercent?: number;
previousValue?: number;
}
export interface WidgetChartData {
labels: string[];
datasets: {
label: string;
data: number[];
backgroundColor?: string[];
}[];
}
export interface WidgetListItem {
id: string;
title: string;
subtitle?: string;
status?: string;
priority?: string;
dueDate?: string;
startTime?: string;
color?: string;
}
export interface WidgetCalendarItem {
id: string;
title: string;
startTime: string;
endTime?: string;
allDay?: boolean;
type: "task" | "event";
color?: string;
}