Made the ability to edit tasks and removed the placeholder notes and reminders from each task

This commit is contained in:
NPS Agent
2026-05-11 15:38:30 +09:30
parent 39d26be447
commit 13e92e2b27
4 changed files with 57 additions and 30 deletions
+36 -18
View File
@@ -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
</div>
)}
{task.description && (
<p className="detail__desc">{task.description}</p>
)}
<div className="detail__desc-section" style={{ marginBottom: '1.5rem' }}>
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', marginBottom: '0.5rem' }}>
<h3 className="detail__h" style={{ margin: 0 }}>Description</h3>
{!editingDesc && (
<IconBtn label="Edit description" onClick={() => setEditingDesc(true)}>
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.5"><path d="M12.5 3.5l-8 8V14h2.5l8-8-2.5-2.5z" strokeLinecap="round" strokeLinejoin="round"/><path d="M10.5 5.5l2 2" strokeLinecap="round" strokeLinejoin="round"/></svg>
</IconBtn>
)}
</div>
{editingDesc ? (
<div className="detail__desc-edit">
<textarea
className="field__textarea"
value={descValue}
onChange={e => setDescValue(e.target.value)}
autoFocus
rows={4}
/>
<div className="detail__alert-actions" style={{ marginTop: '0.5rem' }}>
<button className="btn btn--ghost btn--sm" onClick={() => { setDescValue(task.description || ''); setEditingDesc(false); }}>Cancel</button>
<button className="btn btn--primary btn--sm" onClick={() => { onEditDesc(descValue); setEditingDesc(false); }}>Save</button>
</div>
</div>
) : (
<p className="detail__desc" style={{ marginTop: 0 }}>{task.description || <span className="mono" style={{opacity: 0.5}}>No description</span>}</p>
)}
</div>
<div className="detail__notes">
<h3 className="detail__h">Notes &amp; reminders</h3>
<ul className="notes">
<li className="notes__item">
<span className="notes__bullet"><Icon.Pin /></span>
<div>
<div>Customer wants pickup before <strong>Friday 3pm</strong>.</div>
<div className="notes__meta mono">Lani · 09:14</div>
</div>
</li>
<li className="notes__item">
<span className="notes__bullet"><Icon.Bell /></span>
<div>
<div>Reminder set for <strong>Thu 4pm</strong> if no response by then.</div>
<div className="notes__meta mono">auto · 2h before due</div>
</div>
</li>
{/* Dynamic notes will go here */}
</ul>
<div className="notes__add">
<input className="field__input" placeholder="Add a note or @mention…" />