Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Rebase PR #10 onto main (2026-06-19)

### Fixed
- Rebased `cursor/fix-new-task-display-0037` onto `main` (replacing the merge commit) so GitHub can update the branch cleanly.
- Kept both `revealDetailScroll` on add and `restoreDetailScroll` on same-task reopen in `openDetail`.

## Fix manual task add button (2026-06-17)

### Fixed
Expand Down
32 changes: 27 additions & 5 deletions src/app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -902,11 +902,15 @@ function addChild(id){
if(!path||path.length>=3) return;
snap();
const n=path[path.length-1];
const taskDue=n.due||dayIso(LEAD.m);
n.children.push(T(cap1(v),n.owner,{d:taskDue,s:"m"}));
let taskDue=n.due||dayIso(LEAD.m);
if(focusToday&&dayN(taskDue)>0) taskDue=dayIso(0); // stay visible when today's-focus filter is on
const child=T(cap1(v),n.owner,{d:taskDue,s:"m"});
n.children.push(child);
n.open=true;
if(path.length>1&&!subOpen(id)){ if(subsAll) COL.delete(id); else EXP.add(id); } // show new subtask rows on the gantt
renderAll();
openDetail(id);
openDetail(id,{reveal:"bottom"});
revealGanttTask(child.id);
}
function addProject(){
snap();
Expand All @@ -918,7 +922,24 @@ function addProject(){
if(ti){ ti.focus(); ti.select(); }
}
let DETAIL_ID=null;
function openDetail(id){
function revealDetailScroll(box,reveal){
if(!box||!reveal) return;
const apply=()=>{ box.scrollTop=reveal==="bottom"?box.scrollHeight:reveal; };
apply();
if(typeof requestAnimationFrame!=="undefined")
requestAnimationFrame(()=>{ apply(); requestAnimationFrame(apply); });
}
function revealGanttTask(id){
const run=()=>{
const bar=document.querySelector(`#gantt .gbar[data-tid="${id}"]`);
if(bar){ bar.scrollIntoView({block:"nearest"}); return; }
const path=findPath(id);
if(path?.[0]) document.querySelector(`.pgroup[data-pid="${path[0].id}"]`)?.scrollIntoView({block:"nearest"});
};
if(typeof requestAnimationFrame!=="undefined") requestAnimationFrame(()=>requestAnimationFrame(run));
else run();
}
function openDetail(id,opts){
const path=findPath(id);
if(!path){ if(DETAIL_ID===id) closeSheet(); DETAIL_ID=null; return; }
const box=document.querySelector(".tbox");
Expand Down Expand Up @@ -970,7 +991,8 @@ function openDetail(id){
<button class="danger" onclick="deleteTask(${id})">Delete ${path.length===1?"project":path.length>=3?"subtask":"task"}</button>`;
document.getElementById("tmodal").classList.add("show");
document.getElementById("scrim").classList.add("show");
restoreDetailScroll(box,savedScroll);
if(opts?.reveal) revealDetailScroll(box,opts.reveal);
else restoreDetailScroll(box,savedScroll);
}
function closeSheet(){ DETAIL_ID=null;
document.getElementById("tmodal").classList.remove("show");
Expand Down
Loading