diff --git a/web/src/dashboard.ts b/web/src/dashboard.ts index 99da224..5f7f8b8 100644 --- a/web/src/dashboard.ts +++ b/web/src/dashboard.ts @@ -326,10 +326,9 @@ function renderBookCard(book: BookInfo): string { const coverUrl = book.cover_image_path || "/static/placeholder-book.svg"; return ` + @@ -348,12 +347,10 @@ function renderBookCard(book: BookInfo): string { ${book.author ? `${book.author}` : ""} + `; } -// function viewBook(bookId: string): void { -// console.log("View book:", bookId); -// } async function reloadPage(): Promise { //Get current library from dropdown @@ -468,11 +465,6 @@ function initDashboard() { break; } - // case "view-book": { - // const bookId = target.dataset.bookId || actionElem?.dataset.bookId; - // if (bookId) viewBook(bookId); - // break; - // } case "reload-page": reloadPage(); @@ -485,33 +477,34 @@ function initDashboard() { } } - document.addEventListener("input", (e: Event) => { - const target = e.target as HTMLElement; - const actionElem = target.closest("[data-input-action]") as HTMLElement; - const action = actionElem?.getAttribute("data-input-action"); + }); - switch (action) { - case "update-items-count": { - const input = target as HTMLInputElement; - const displayTarget = input.getAttribute("target"); - if (displayTarget) updateItemsCount(input, displayTarget); - break; - } + document.addEventListener("input", (e: Event) => { + const target = e.target as HTMLElement; + const actionElem = target.closest("[data-input-action]") as HTMLElement; + const action = actionElem?.getAttribute("data-input-action"); + + switch (action) { + case "update-items-count": { + const input = target as HTMLInputElement; + const displayTarget = input.getAttribute("target"); + if (displayTarget) updateItemsCount(input, displayTarget); + break; } - }); - // Load saved library on page load - const librarySelect = document.getElementById( - "library-select", - ) as HTMLSelectElement; - if (librarySelect) { - librarySelect.addEventListener("change", (e) => { - const target = e.target as HTMLSelectElement; - if (target.value) { - switchLibrary(target.value); - } - }); } }); + + const librarySelect = document.getElementById( + "library-select", + ) as HTMLSelectElement; + if (librarySelect) { + librarySelect.addEventListener("change", (e) => { + const target = e.target as HTMLSelectElement; + if (target.value) { + switchLibrary(target.value); + } + }); + } } export { initDashboard };
${book.author}