feat: Add search, quick add task, export, today's focus, keyboard shortcuts
This commit is contained in:
@@ -7,6 +7,7 @@ interface MissionControlStore {
|
||||
tasks: Task[];
|
||||
toggleTask: (id: string) => void;
|
||||
updateTaskStatus: (id: string, status: TaskStatus) => void;
|
||||
addTask: (task: Omit<Task, "id" | "order">) => void;
|
||||
getProjectProgress: (projectId: string) => number;
|
||||
getTasksByProject: (projectId: string) => Task[];
|
||||
}
|
||||
@@ -68,6 +69,15 @@ export function MissionControlProvider({ children }: { children: ReactNode }) {
|
||||
);
|
||||
};
|
||||
|
||||
const addTask = (task: Omit<Task, "id" | "order">) => {
|
||||
const newTask: Task = {
|
||||
...task,
|
||||
id: `t-${Date.now()}`,
|
||||
order: tasks.length + 1,
|
||||
};
|
||||
setTasks((prev) => [...prev, newTask]);
|
||||
};
|
||||
|
||||
const getProjectProgress = (projectId: string) => {
|
||||
const projectTasks = tasks.filter((t) => t.project === projectId);
|
||||
if (projectTasks.length === 0) return 0;
|
||||
@@ -85,6 +95,7 @@ export function MissionControlProvider({ children }: { children: ReactNode }) {
|
||||
tasks,
|
||||
toggleTask,
|
||||
updateTaskStatus,
|
||||
addTask,
|
||||
getProjectProgress,
|
||||
getTasksByProject,
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user