feat: add dashboard and commands

This commit is contained in:
2026-07-14 10:00:15 +05:00
parent 2f09b3754e
commit 3490781ad5
13 changed files with 835 additions and 1 deletions
+31
View File
@@ -0,0 +1,31 @@
import { Task } from "@/model/task";
import { filterTasks, type TaskFilter } from "./filterTasks";
import { groupTasks, type GroupBy, type TaskGroup } from "./groupTasks";
export type DashboardViewOptions = {
filter?: TaskFilter;
groupBy?: GroupBy;
selectedId?: string;
};
export type DashboardView = {
visibleTasks: Task[];
groups: TaskGroup[];
selected: Task | undefined;
};
export function buildDashboardView(
tasks: Task[],
options: DashboardViewOptions = {},
): DashboardView {
const filter = options.filter ?? {};
const groupBy = options.groupBy ?? "none";
const visibleTasks = filterTasks(tasks, filter);
const groups = groupTasks(visibleTasks, groupBy);
const selected = options.selectedId
? tasks.find((t) => t.id === options.selectedId)
: undefined;
return { visibleTasks, groups, selected };
}