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:
John O'Keefe committed 2026-10-21 13:18:24 -04:00
1 parent 8aeecaa0ef
commit 77cd268f4e
37 files changed
+1151 -1853

No files matched your search

+16 -53
View File
@@ -57,13 +57,8 @@ async function scanAllLibraries(): Promise<void> {
}
}
function showScanProgress(
jobIds: string[],
libraryNames: Record<string, string>,
): void {
const container = document.getElementById(
"scan-progress-container",
) as HTMLElement;
function showScanProgress(jobIds: string[], libraryNames: Record<string, string>): void {
const container = document.getElementById("scan-progress-container") as HTMLElement;
const list = document.getElementById("library-progress-list") as HTMLElement;
if (!container || !list) return;
@@ -113,10 +108,7 @@ function showScanProgress(
let scanPollInterval: ReturnType<typeof setInterval> | undefined = undefined;
function pollScanProgress(
jobIds: string[],
_libraryNames: Record<string, string>,
): void {
function pollScanProgress(jobIds: string[], _libraryNames: Record<string, string>): void {
const token = localStorage.getItem("token");
const startTime = Date.now();
const cancelledJobs = new Set<string>();
@@ -168,14 +160,9 @@ function pollScanProgress(
}
// status.progress arrives 0-1 from the server; render as percent.
const overallProgress =
progressJobs > 0 ? Math.round((totalProgress / progressJobs) * 100) : 0;
const progressBar = document.getElementById(
"scan-progress-bar",
) as HTMLElement;
const progressText = document.getElementById(
"scan-progress-text",
) as HTMLElement;
const overallProgress = progressJobs > 0 ? Math.round((totalProgress / progressJobs) * 100) : 0;
const progressBar = document.getElementById("scan-progress-bar") as HTMLElement;
const progressText = document.getElementById("scan-progress-text") as HTMLElement;
const statusText = document.getElementById("scan-status") as HTMLElement;
if (progressBar) progressBar.style.width = overallProgress + "%";
@@ -241,9 +228,7 @@ async function cancelScan(jobId: string): Promise<void> {
const token = localStorage.getItem("token");
if (!token) return;
const btn = document.querySelector<HTMLButtonElement>(
`[data-cancel-job="${jobId}"]`,
);
const btn = document.querySelector<HTMLButtonElement>(`[data-cancel-job="${jobId}"]`);
if (btn) {
btn.disabled = true;
btn.textContent = "Cancelling...";
@@ -260,10 +245,7 @@ async function cancelScan(jobId: string): Promise<void> {
}
showToast("Scan cancellation requested", "success");
} catch (e) {
showToast(
e instanceof Error ? e.message : "Failed to cancel scan",
"error",
);
showToast(e instanceof Error ? e.message : "Failed to cancel scan", "error");
if (btn) {
btn.disabled = false;
btn.textContent = "Cancel";
@@ -291,10 +273,7 @@ async function cancelAllScans(): Promise<void> {
await Promise.allSettled(jobs.map((job) => cancelScan(job.job_id)));
} catch (e) {
showToast(
e instanceof Error ? e.message : "Failed to cancel scans",
"error",
);
showToast(e instanceof Error ? e.message : "Failed to cancel scans", "error");
}
}
@@ -361,9 +340,7 @@ function showScanResults(
cancelled: number,
): void {
const resultsDiv = document.getElementById("scan-results") as HTMLElement;
const contentDiv = document.getElementById(
"scan-results-content",
) as HTMLElement;
const contentDiv = document.getElementById("scan-results-content") as HTMLElement;
if (!resultsDiv || !contentDiv) return;
@@ -381,16 +358,12 @@ function showScanResults(
const statusText = document.getElementById("scan-status") as HTMLElement;
if (statusText) {
statusText.textContent =
cancelled > 0
? "Scan finished (some scans were cancelled)"
: "Scan complete!";
cancelled > 0 ? "Scan finished (some scans were cancelled)" : "Scan complete!";
}
}
function hideScanProgress(): void {
const container = document.getElementById(
"scan-progress-container",
) as HTMLElement;
const container = document.getElementById("scan-progress-container") as HTMLElement;
if (container) container.classList.add("hidden");
setCancelAllVisible(false);
}
@@ -447,16 +420,10 @@ async function purgeArchivedItems(): Promise<void> {
throw new Error(err.error || "Failed to purge archived items");
}
const data = await resp.json();
showToast(
`Purged ${data.purged} archived item${data.purged === 1 ? "" : "s"}`,
"success",
);
showToast(`Purged ${data.purged} archived item${data.purged === 1 ? "" : "s"}`, "success");
setTimeout(() => window.location.reload(), 700);
} catch (e) {
showToast(
e instanceof Error ? e.message : "Failed to purge archived items",
"error",
);
showToast(e instanceof Error ? e.message : "Failed to purge archived items", "error");
}
}
@@ -551,9 +518,7 @@ document.querySelectorAll<HTMLElement>("[data-unarchive]").forEach((el) => {
el.addEventListener("click", () => unarchiveItem(el.dataset.unarchive || ""));
});
document.querySelectorAll<HTMLElement>("[data-delete-archived]").forEach((el) => {
el.addEventListener("click", () =>
deleteArchivedItem(el.dataset.deleteArchived || ""),
);
el.addEventListener("click", () => deleteArchivedItem(el.dataset.deleteArchived || ""));
});
document.querySelectorAll<HTMLElement>("[data-merge-source]").forEach((el) => {
el.addEventListener("click", () =>
@@ -631,9 +596,7 @@ function bindDeleteLibraryModalClose(): void {
?.addEventListener("htmx:afterRequest", function (evt) {
const detail = (evt as CustomEvent).detail as { successful?: boolean };
if (detail.successful) {
document
.getElementById("delete-library-modal")
?.classList.add("hidden");
document.getElementById("delete-library-modal")?.classList.add("hidden");
}
});
}