style: format web/src with oxfmt defaults (via vp fmt)
One-time mechanical sweep, isolated from any functional change. - oxfmt defaults: double quotes, semicolons, 2-space indent, LF, printWidth 100, trailing commas, bracket spacing, arrow parens. - vite.config.ts gains an fmt.ignorePatterns block for web/static: vendored/minified assets (htmx.min.js, compiled css) must never be reformatted. - Verified: rebuild after the sweep produces byte-identical JS/CSS bundles; only sourcemaps changed (they embed sourcesContent).
This commit is contained in:
1 parent
8aeecaa0ef
commit
77cd268f4e
37 files changed
+1151
-1853
No files matched your search
+24
-78
@@ -4,11 +4,7 @@ import { getToken } from "./storage";
|
||||
|
||||
let selectedMediaItem: string | null = null;
|
||||
|
||||
function searchMatches(
|
||||
progressId: string,
|
||||
sha256: string,
|
||||
title: string,
|
||||
): void {
|
||||
function searchMatches(progressId: string, sha256: string, title: string): void {
|
||||
const container = document.getElementById(`matches-${progressId}`);
|
||||
const matchesList = document.getElementById(`matches-list-${progressId}`);
|
||||
|
||||
@@ -38,18 +34,8 @@ function searchMatches(
|
||||
});
|
||||
}
|
||||
|
||||
function autoLinkBook(
|
||||
progressId: string,
|
||||
mediaItemId: string,
|
||||
confidence: number,
|
||||
): void {
|
||||
if (
|
||||
!confirm(
|
||||
"Link this book? The confidence score is " +
|
||||
Math.round(confidence * 100) +
|
||||
"%",
|
||||
)
|
||||
) {
|
||||
function autoLinkBook(progressId: string, mediaItemId: string, confidence: number): void {
|
||||
if (!confirm("Link this book? The confidence score is " + Math.round(confidence * 100) + "%")) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -88,12 +74,8 @@ function autoLinkBook(
|
||||
|
||||
function showManualLinkModal(progressId: string, bookTitle: string): void {
|
||||
const modal = document.getElementById("manual-link-modal");
|
||||
const progressIdInput = document.getElementById(
|
||||
"link-progress-id",
|
||||
) as HTMLInputElement;
|
||||
const bookTitleInput = document.getElementById(
|
||||
"link-book-title",
|
||||
) as HTMLInputElement;
|
||||
const progressIdInput = document.getElementById("link-progress-id") as HTMLInputElement;
|
||||
const bookTitleInput = document.getElementById("link-book-title") as HTMLInputElement;
|
||||
const searchResults = document.getElementById("link-search-results");
|
||||
|
||||
if (modal) modal.classList.remove("hidden");
|
||||
@@ -107,9 +89,7 @@ function showManualLinkModal(progressId: string, bookTitle: string): void {
|
||||
|
||||
function hideManualLinkModal(): void {
|
||||
const modal = document.getElementById("manual-link-modal");
|
||||
const searchInput = document.getElementById(
|
||||
"link-search-input",
|
||||
) as HTMLInputElement;
|
||||
const searchInput = document.getElementById("link-search-input") as HTMLInputElement;
|
||||
|
||||
if (modal) modal.classList.add("hidden");
|
||||
if (searchInput) searchInput.value = "";
|
||||
@@ -117,9 +97,7 @@ function hideManualLinkModal(): void {
|
||||
}
|
||||
|
||||
function searchBooksForLink(): void {
|
||||
const searchInput = document.getElementById(
|
||||
"link-search-input",
|
||||
) as HTMLInputElement;
|
||||
const searchInput = document.getElementById("link-search-input") as HTMLInputElement;
|
||||
const resultsContainer = document.getElementById("link-search-results");
|
||||
|
||||
if (!searchInput || !resultsContainer) return;
|
||||
@@ -195,18 +173,10 @@ function confirmManualLink(): void {
|
||||
return;
|
||||
}
|
||||
|
||||
const progressIdInput = document.getElementById(
|
||||
"link-progress-id",
|
||||
) as HTMLInputElement;
|
||||
const confidenceInput = document.getElementById(
|
||||
"link-confidence",
|
||||
) as HTMLInputElement;
|
||||
const bookTitleInput = document.getElementById(
|
||||
"link-book-title",
|
||||
) as HTMLInputElement;
|
||||
const sha256Input = document.getElementById(
|
||||
"link-book-sha256",
|
||||
) as HTMLInputElement;
|
||||
const progressIdInput = document.getElementById("link-progress-id") as HTMLInputElement;
|
||||
const confidenceInput = document.getElementById("link-confidence") as HTMLInputElement;
|
||||
const bookTitleInput = document.getElementById("link-book-title") as HTMLInputElement;
|
||||
const sha256Input = document.getElementById("link-book-sha256") as HTMLInputElement;
|
||||
|
||||
if (!progressIdInput) return;
|
||||
|
||||
@@ -245,9 +215,7 @@ function confirmManualLink(): void {
|
||||
}
|
||||
|
||||
function toggleAllUnlinked(): void {
|
||||
const selectAll = document.getElementById(
|
||||
"select-all-unlinked",
|
||||
) as HTMLInputElement;
|
||||
const selectAll = document.getElementById("select-all-unlinked") as HTMLInputElement;
|
||||
if (!selectAll) return;
|
||||
|
||||
document.querySelectorAll(".unlinked-checkbox").forEach((cb) => {
|
||||
@@ -257,9 +225,7 @@ function toggleAllUnlinked(): void {
|
||||
}
|
||||
|
||||
function getSelectedUnlinked(): { progressId: string; title: string }[] {
|
||||
return Array.from(
|
||||
document.querySelectorAll(".unlinked-checkbox:checked"),
|
||||
).map((cb) => ({
|
||||
return Array.from(document.querySelectorAll(".unlinked-checkbox:checked")).map((cb) => ({
|
||||
progressId: cb.getAttribute("data-progress-id") || "",
|
||||
title: cb.getAttribute("data-title") || "",
|
||||
}));
|
||||
@@ -280,11 +246,7 @@ async function bulkAutoLink(): Promise<void> {
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
!confirm(
|
||||
`Auto-link ${selected.length} books with high confidence matches (≥80%)?`,
|
||||
)
|
||||
) {
|
||||
if (!confirm(`Auto-link ${selected.length} books with high confidence matches (≥80%)?`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -303,10 +265,7 @@ async function bulkAutoLink(): Promise<void> {
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
showToast(
|
||||
`Auto-linked ${result.auto_linked} books successfully`,
|
||||
"success",
|
||||
);
|
||||
showToast(`Auto-linked ${result.auto_linked} books successfully`, "success");
|
||||
setTimeout(() => window.location.reload(), 1500);
|
||||
} catch (error) {
|
||||
console.error("Auto-link failed", error);
|
||||
@@ -324,14 +283,11 @@ async function bulkGetSuggestions(): Promise<void> {
|
||||
const token = getToken();
|
||||
for (const book of selected) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`/sync/unlinked-books/${book.progressId}/suggestions`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
const response = await fetch(`/sync/unlinked-books/${book.progressId}/suggestions`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
displaySuggestions(book.progressId, result.suggestions, result.action);
|
||||
@@ -341,11 +297,7 @@ async function bulkGetSuggestions(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
function displaySuggestions(
|
||||
progressId: string,
|
||||
suggestions: any[],
|
||||
_action: string,
|
||||
): void {
|
||||
function displaySuggestions(progressId: string, suggestions: any[], _action: string): void {
|
||||
const container = document.getElementById(`matches-${progressId}`);
|
||||
if (!container) return;
|
||||
|
||||
@@ -356,15 +308,13 @@ function displaySuggestions(
|
||||
listContainer.innerHTML = "";
|
||||
|
||||
if (suggestions.length === 0) {
|
||||
listContainer.innerHTML =
|
||||
'<p style="color: var(--text-secondary)">No matches found</p>';
|
||||
listContainer.innerHTML = '<p style="color: var(--text-secondary)">No matches found</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
suggestions.forEach((match) => {
|
||||
const div = document.createElement("div");
|
||||
div.className =
|
||||
"p-3 border rounded cursor-pointer hover:bg-opacity-80 transition-colors";
|
||||
div.className = "p-3 border rounded cursor-pointer hover:bg-opacity-80 transition-colors";
|
||||
div.style.cssText = `background-color: var(--bg-primary); border-color: var(--border);`;
|
||||
div.innerHTML = `
|
||||
<div class="flex justify-between items-center">
|
||||
@@ -400,8 +350,7 @@ function showBulkManualLink(): void {
|
||||
"info",
|
||||
);
|
||||
window.location.href =
|
||||
"/library?mode=link&unlinked=" +
|
||||
selected.map((s) => s.progressId).join(",");
|
||||
"/library?mode=link&unlinked=" + selected.map((s) => s.progressId).join(",");
|
||||
}
|
||||
|
||||
function setupEventDelegation(): void {
|
||||
@@ -420,10 +369,7 @@ function setupEventDelegation(): void {
|
||||
parseFloat(card.dataset.confidence || "0"),
|
||||
);
|
||||
} else if (action === "select-book") {
|
||||
selectBookForLink(
|
||||
card.dataset.mediaItemId || "",
|
||||
card.dataset.cover || "",
|
||||
);
|
||||
selectBookForLink(card.dataset.mediaItemId || "", card.dataset.cover || "");
|
||||
} else if (action === "select-match") {
|
||||
autoLinkBook(
|
||||
card.dataset.progressId || "",
|
||||
|
||||
Reference in new issue
Block a user