diff options
| author | soryu <soryu@soryu.co> | 2026-01-22 13:16:01 +0000 |
|---|---|---|
| committer | soryu <soryu@soryu.co> | 2026-01-22 13:16:01 +0000 |
| commit | c5cd9fe0515f024a6f442e6b7eca614a38aa6deb (patch) | |
| tree | 3945da69ce346798b413d7063485aebfd5be3d11 /makima/frontend/src/hooks/useTasks.ts | |
| parent | 1b1b737006f9505b2a188a669c5a37671658ce3f (diff) | |
| download | soryu-makima/task-task-5dde682c-5dde682c.tar.gz soryu-makima/task-task-5dde682c-5dde682c.zip | |
Add dismiss functionality for completed standalone tasksmakima/task-task-5dde682c-5dde682c
## Changes
### Backend
- Add 'hidden' field to Task model (models.rs)
- Add database migration for hidden column (20250122000000_add_task_hidden.sql)
- Update task listing queries to include hidden field and filter out hidden tasks
- Update update_task_for_owner to handle hidden field
### Frontend
- Add hidden field to TaskSummary interface (api.ts)
- Add dismissTask API function (api.ts)
- Add hideTask function to useTasks hook
- Add Dismiss button to TaskList for completed standalone tasks
- Wire up onDismiss handler in mesh.tsx route
## Behavior
- Completed standalone tasks (tasks without a contract) show a "Dismiss" button
- Dismissing a task sets hidden=true and removes it from the task list
- Hidden tasks are filtered out by default in all task listing queries
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'makima/frontend/src/hooks/useTasks.ts')
| -rw-r--r-- | makima/frontend/src/hooks/useTasks.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/makima/frontend/src/hooks/useTasks.ts b/makima/frontend/src/hooks/useTasks.ts index 6e6c992..4667c4c 100644 --- a/makima/frontend/src/hooks/useTasks.ts +++ b/makima/frontend/src/hooks/useTasks.ts @@ -5,6 +5,7 @@ import { createTask, updateTask, deleteTask, + dismissTask, VersionConflictError, type TaskSummary, type TaskWithSubtasks, @@ -110,6 +111,21 @@ export function useTasks() { [fetchTasks] ); + const hideTask = useCallback( + async (id: string): Promise<boolean> => { + setError(null); + try { + await dismissTask(id); + await fetchTasks(); // Refresh list + return true; + } catch (e) { + setError(e instanceof Error ? e.message : "Failed to dismiss task"); + return false; + } + }, + [fetchTasks] + ); + // Initial fetch useEffect(() => { fetchTasks(); @@ -126,5 +142,6 @@ export function useTasks() { saveTask, editTask, removeTask, + hideTask, }; } |
