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
+8
-14
@@ -11,8 +11,7 @@ const createToastContainer = (): HTMLElement => {
|
||||
if (!container) {
|
||||
container = document.createElement("div");
|
||||
container.id = "toast-container";
|
||||
container.className =
|
||||
"fixed top-5 right-5 z-[9999] flex flex-col gap-2.5 pointer-events-none";
|
||||
container.className = "fixed top-5 right-5 z-[9999] flex flex-col gap-2.5 pointer-events-none";
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
return container;
|
||||
@@ -141,11 +140,7 @@ const setupHTMXListeners = (): void => {
|
||||
if (customEvent.detail.xhr) {
|
||||
const xhr = customEvent.detail.xhr;
|
||||
|
||||
if (
|
||||
customEvent.detail.succeeded === false &&
|
||||
xhr.status >= 400 &&
|
||||
xhr.status < 600
|
||||
) {
|
||||
if (customEvent.detail.succeeded === false && xhr.status >= 400 && xhr.status < 600) {
|
||||
const errorMessage = parseXHRError(xhr);
|
||||
showToast(errorMessage, "error");
|
||||
} else if (xhr.status >= 200 && xhr.status < 300) {
|
||||
@@ -188,7 +183,10 @@ function isSuggestionFetch(input: Parameters<typeof fetch>[0]): boolean {
|
||||
const url = typeof input === "string" ? input : input instanceof URL ? input.href : input.url;
|
||||
// The builder's live-count endpoint is a background hint too — a
|
||||
// failed count must never interrupt with a toast.
|
||||
if (!url.includes("/api/media-items/search?") && !url.includes("/api/media-items/filter-count?")) {
|
||||
if (
|
||||
!url.includes("/api/media-items/search?") &&
|
||||
!url.includes("/api/media-items/filter-count?")
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (url.includes("/api/media-items/filter-count?")) return true;
|
||||
@@ -198,9 +196,7 @@ function isSuggestionFetch(input: Parameters<typeof fetch>[0]): boolean {
|
||||
// Setup fetch interceptor
|
||||
const setupFetchInterceptor = (): void => {
|
||||
const originalFetch = window.fetch;
|
||||
window.fetch = async (
|
||||
...args: Parameters<typeof fetch>
|
||||
): Promise<Response> => {
|
||||
window.fetch = async (...args: Parameters<typeof fetch>): Promise<Response> => {
|
||||
try {
|
||||
const response = await originalFetch(...args);
|
||||
|
||||
@@ -233,9 +229,7 @@ const setupFetchInterceptor = (): void => {
|
||||
if (!response.ok) {
|
||||
const errorMessage = await parseFetchError(response);
|
||||
if (isSuggestionFetch(args[0])) {
|
||||
console.warn(
|
||||
`Suggestion fetch failed (${response.status}): ${errorMessage}`,
|
||||
);
|
||||
console.warn(`Suggestion fetch failed (${response.status}): ${errorMessage}`);
|
||||
} else {
|
||||
showToast(errorMessage, "error");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user