Compare commits
2 Commits
3f0fccd218
...
5e827e7d99
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5e827e7d99 | ||
|
|
fcee783ee5 |
@ -52,7 +52,6 @@ async function loadTasks() {
|
||||
if (savedTaskExists) {
|
||||
focusTaskId = savedTaskId;
|
||||
scrollToTask(savedTaskId);
|
||||
selectedTaskId = savedTaskId;
|
||||
if (isLandscapeMode()) {
|
||||
selectTask(savedTaskId);
|
||||
}
|
||||
@ -69,8 +68,6 @@ 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(() => {
|
||||
if (focusTaskId) {
|
||||
document.querySelectorAll(".task-item.in-focus").forEach(el => el.classList.remove("in-focus"));
|
||||
@ -79,6 +76,22 @@ async function loadTasks() {
|
||||
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();
|
||||
});
|
||||
} catch (error) {
|
||||
@ -232,6 +245,14 @@ function selectTask(taskId) {
|
||||
|
||||
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-desc").value = task.desc || "";
|
||||
document.getElementById("side-panel-error").textContent = "";
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user