From 13e92e2b27fd87456d3c638eee2611ceb271d71c Mon Sep 17 00:00:00 2001 From: NPS Agent Date: Mon, 11 May 2026 15:38:30 +0930 Subject: [PATCH] Made the ability to edit tasks and removed the placeholder notes and reminders from each task --- PROGRESS.md | 21 ++++++++++---------- app.jsx | 12 +++++++++++- dashy.db | Bin 61440 -> 61440 bytes screens.jsx | 54 ++++++++++++++++++++++++++++++++++------------------ 4 files changed, 57 insertions(+), 30 deletions(-) diff --git a/PROGRESS.md b/PROGRESS.md index bfc4338..c772762 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -42,17 +42,16 @@ ## ⏭️ Upcoming Steps ### Phase 2: Frontend Refactor & Workflow Polish (✅ Completed) -1. **API Service:** Created `api.js` to dynamically connect to the backend (resolved connection refused issues by using dynamic hostnames) and handle all network requests. -2. **Authentication Hook:** Updated the Login screen to use real JWT tokens. -3. **Component Updates:** - - Swapped `DashyDB` calls for `async` API calls in `app.jsx`. - - Fixed UI state refresh issues by silently loading subsequent data updates. -4. **Task Workflows:** - - **Completion:** Added a "Mark as completed" button in `TaskDetail` that changes task status to `closed`, records it in the Audit Log, and removes the task from the main Overview board. - - **Reopening:** Added a "Reopen task" button to restore accidentally closed tasks back to the queue. - - **User Views:** Updated `UserScreen` to accurately display open task counts and render a dedicated, faded "Completed" section at the bottom for closed tasks. - - **Audit Rendering:** Fixed crash in `TaskDetail` by passing global API audit logs and filtering them locally for individual tasks. -5. **Cleanup:** Archived `db.js`, `data.jsx` to `Dashy-v1/scraps/` and removed `sql.js` WASM dependency from `Dashy.html`. +1. **API Integration:** Created `api.js` to handle network requests, swapped `DashyDB` for async API calls in `app.jsx`, and updated Login to use JWT tokens. +2. **Legacy Cleanup:** Archived `db.js` and `data.jsx` to `Dashy-v1/scraps/` and removed `sql.js` WASM dependency from `Dashy.html`. +3. **API Base URL Fix:** Updated `api.js` to dynamically use the browser's hostname to resolve "Connection Refused" errors. +4. **Audit Rendering Crash Fix:** Resolved the `TASK_AUDIT` ReferenceError by passing live API audit logs into the `TaskDetail` modal. +5. **UI State Refresh Fix:** Modified the `useApiData` hook to fetch subsequent updates silently without unmounting the app (fixing the drag-and-drop refresh bug). +6. **Task Completion:** Added a "Mark as completed" button, removed closed tasks from the main Overview board, and set up audit logging. +7. **User Views Update:** Updated `UserScreen` to accurately display open task counts and render a dedicated, faded "Completed" section for closed tasks. +8. **Task Reopening:** Added a "Reopen task" button to restore accidentally closed tasks back to the queue. +9. **User Management (Settings):** Built backend API endpoints (`POST`, `PATCH`, `DELETE` for `/users`) and wired up the `WorkspaceTab` allowing Admins to manage the team from the UI. +10. **Task Editing:** Implemented inline editing for task descriptions using an active text box state with "Save/Cancel" actions. ### Phase 3: Advanced Features - **Real-time Notifications:** Explore WebSockets for task assignments. diff --git a/app.jsx b/app.jsx index dd05473..987bf82 100644 --- a/app.jsx +++ b/app.jsx @@ -156,6 +156,16 @@ function App() { } }; + const editTaskDesc = async (taskId, newDesc) => { + try { + await api.updateTask(taskId, { description: newDesc }); + await api.addAudit({ actor: meId, action: 'task_edited', summary: 'Updated task description', target: taskId }); + } catch(e) { + console.error(e); + alert("Failed to update description: " + e.message); + } + }; + const dismissHU = (id) => setHeadsUp(h => h.filter(x => x.id !== id)); const openTaskFromAnywhere = (id) => { setOpenTaskId(id); setShowLogs(false); }; @@ -213,7 +223,7 @@ function App() { setAdding(null)} onSubmit={addTask} defaultAssignee={adding} me={me} /> {mappedOpenTask && ( - setOpenTaskId(null)} onMove={moveTask} onPriority={setPriority} onComplete={() => completeTask(mappedOpenTask.id)} onReopen={() => reopenTask(mappedOpenTask.id)} /> + setOpenTaskId(null)} onMove={moveTask} onPriority={setPriority} onComplete={() => completeTask(mappedOpenTask.id)} onReopen={() => reopenTask(mappedOpenTask.id)} onEditDesc={(newDesc) => editTaskDesc(mappedOpenTask.id, newDesc)} /> )} {showLogs && ( setShowLogs(false)} wide> diff --git a/dashy.db b/dashy.db index 0ee0f94b61220eafcd2b9424e51a3d170921a09e..5efd1e3047200c479bb5aa11f80569a5fa5ec538 100644 GIT binary patch delta 688 zcmZp8z})bFd4e=!_(U0J#_){^OZ=Jj8Cxf_2ZVDlO=Hq$yu#SJaiTnrZn3q`scZr`4$UtRV!Nhn|6BAQY%alYk1C6W#f!46bq0QxM=X!DmK0bUP%-UJ5zU;Ll> z-|#=>&*fXiC&GV??-_3bA1j|S|8d@3yuEz0`5pMa@*DE?@W=7h^6lhvf|3n#QM*ocoOZ=I&nVwB%4+!5lv4d&zvmiNM2W{Rt4E(?NKl8ug zf6AZBw~9}M{~F&jK2|+#-o!_5diFXcv4exV) z7XDeAeG)`?CoXWAoRG`5c~NdW6DPY010P#3J6rH%t^%peiURs<9F2aAyn?BX{*xD! znN5CJHkpM-h9O|$M4!zi_ diff --git a/screens.jsx b/screens.jsx index dec899c..50c1409 100644 --- a/screens.jsx +++ b/screens.jsx @@ -407,7 +407,14 @@ function Modal({ children, onClose, title, eyebrow, wide = false }) { ); } -function TaskDetail({ task, allAudit = [], onClose, onMove, onPriority, onComplete, onReopen }) { +function TaskDetail({ task, allAudit = [], onClose, onMove, onPriority, onComplete, onReopen, onEditDesc }) { + const [editingDesc, setEditingDesc] = React.useState(false); + const [descValue, setDescValue] = React.useState(task ? task.description || '' : ''); + + React.useEffect(() => { + setDescValue(task ? task.description || '' : ''); + }, [task]); + if (!task) return null; const assignee = findUser(task.assignee); const author = findUser(task.addedBy); @@ -434,27 +441,38 @@ function TaskDetail({ task, allAudit = [], onClose, onMove, onPriority, onComple )} - {task.description && ( -

{task.description}

- )} +
+
+

Description

+ {!editingDesc && ( + setEditingDesc(true)}> + + + )} +
+ {editingDesc ? ( +
+