Compare commits
No commits in common. "5e827e7d99039d69ce9eed0f6065e409858b2203" and "3f0fccd218b23b1c045d893946925b3459ceb10c" have entirely different histories.
5e827e7d99
...
3f0fccd218
@ -52,6 +52,7 @@ async function loadTasks() {
|
|||||||
if (savedTaskExists) {
|
if (savedTaskExists) {
|
||||||
focusTaskId = savedTaskId;
|
focusTaskId = savedTaskId;
|
||||||
scrollToTask(savedTaskId);
|
scrollToTask(savedTaskId);
|
||||||
|
selectedTaskId = savedTaskId;
|
||||||
if (isLandscapeMode()) {
|
if (isLandscapeMode()) {
|
||||||
selectTask(savedTaskId);
|
selectTask(savedTaskId);
|
||||||
}
|
}
|
||||||
@ -68,6 +69,8 @@ async function loadTasks() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Wait one frame so the async scroll event from scrollToTask fires first,
|
||||||
|
// then set in-focus and bind handlers after it has been consumed.
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (focusTaskId) {
|
if (focusTaskId) {
|
||||||
document.querySelectorAll(".task-item.in-focus").forEach(el => el.classList.remove("in-focus"));
|
document.querySelectorAll(".task-item.in-focus").forEach(el => el.classList.remove("in-focus"));
|
||||||
@ -76,22 +79,6 @@ async function loadTasks() {
|
|||||||
focusEl.classList.add("in-focus");
|
focusEl.classList.add("in-focus");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh side panel if a task was selected
|
|
||||||
if (selectedTaskId) {
|
|
||||||
const currentTask = tasks.find(t => t.id === selectedTaskId);
|
|
||||||
if (currentTask) {
|
|
||||||
document.getElementById("edit-task-title").value = currentTask.title;
|
|
||||||
document.getElementById("edit-task-desc").value = currentTask.desc || "";
|
|
||||||
document.querySelectorAll(".status-btn").forEach(btn => {
|
|
||||||
btn.classList.toggle("active", btn.dataset.status === currentTask.status);
|
|
||||||
});
|
|
||||||
updateSaveButton();
|
|
||||||
} else {
|
|
||||||
closeSidePanel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
initScrollFocus();
|
initScrollFocus();
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -245,14 +232,6 @@ function selectTask(taskId) {
|
|||||||
|
|
||||||
if (!task) return;
|
if (!task) return;
|
||||||
|
|
||||||
document.querySelectorAll(".task-item.in-focus").forEach(el => el.classList.remove("in-focus"));
|
|
||||||
const taskEl = document.querySelector(`[data-task-id="${taskId}"]`);
|
|
||||||
if (taskEl) {
|
|
||||||
taskEl.classList.add("in-focus");
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollToTask(taskId);
|
|
||||||
|
|
||||||
document.getElementById("edit-task-title").value = task.title;
|
document.getElementById("edit-task-title").value = task.title;
|
||||||
document.getElementById("edit-task-desc").value = task.desc || "";
|
document.getElementById("edit-task-desc").value = task.desc || "";
|
||||||
document.getElementById("side-panel-error").textContent = "";
|
document.getElementById("side-panel-error").textContent = "";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user