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
+17
-18
@@ -43,7 +43,11 @@ export function localOffsetFor(tracks: AudioTrack[], index: number, globalSecond
|
||||
|
||||
// globalSecondsFor converts (track i, local seconds) back to the global
|
||||
// position — the inverse of localOffsetFor.
|
||||
export function globalSecondsFor(tracks: AudioTrack[], index: number, localSeconds: number): number {
|
||||
export function globalSecondsFor(
|
||||
tracks: AudioTrack[],
|
||||
index: number,
|
||||
localSeconds: number,
|
||||
): number {
|
||||
const track = tracks[index];
|
||||
return (track ? track.start : 0) + Math.max(0, localSeconds);
|
||||
}
|
||||
@@ -309,10 +313,7 @@ Alpine.data("audioReader", () => ({
|
||||
try {
|
||||
const [chaptersResp, progress] = await Promise.all([
|
||||
fetch(readConfig().chapterEndpoint, { headers: getAuthHeaders() }),
|
||||
fetch(
|
||||
`/api/media-items/${this.mediaItemId}/progress`,
|
||||
{ headers: getAuthHeaders() },
|
||||
),
|
||||
fetch(`/api/media-items/${this.mediaItemId}/progress`, { headers: getAuthHeaders() }),
|
||||
]);
|
||||
if (chaptersResp.ok) {
|
||||
const data = await chaptersResp.json();
|
||||
@@ -375,9 +376,7 @@ Alpine.data("audioReader", () => ({
|
||||
|
||||
chapterTitle(): string {
|
||||
const ch = this.chapters[this.currentChapterIdx];
|
||||
return ch
|
||||
? ch.title || `Chapter ${ch.index + 1}`
|
||||
: this.title;
|
||||
return ch ? ch.title || `Chapter ${ch.index + 1}` : this.title;
|
||||
},
|
||||
|
||||
currentChapter(): number {
|
||||
@@ -407,7 +406,10 @@ Alpine.data("audioReader", () => ({
|
||||
},
|
||||
|
||||
skip(direction: 1 | -1) {
|
||||
const target = Math.max(0, this.globalPosition() + direction * (Number(this.skipSeconds) || 10));
|
||||
const target = Math.max(
|
||||
0,
|
||||
this.globalPosition() + direction * (Number(this.skipSeconds) || 10),
|
||||
);
|
||||
this.seekTo(target);
|
||||
},
|
||||
|
||||
@@ -494,8 +496,7 @@ Alpine.data("audioReader", () => ({
|
||||
.filter((b) => String(b.position || "").startsWith("audio:"))
|
||||
.sort(
|
||||
(a, b) =>
|
||||
this.bookmarkSeconds(String(a.position)) -
|
||||
this.bookmarkSeconds(String(b.position)),
|
||||
this.bookmarkSeconds(String(a.position)) - this.bookmarkSeconds(String(b.position)),
|
||||
);
|
||||
} catch {
|
||||
// bookmarks are non-critical UI
|
||||
@@ -558,9 +559,7 @@ Alpine.data("audioReader", () => ({
|
||||
},
|
||||
|
||||
async saveNote() {
|
||||
const b = this.bookmarks.find(
|
||||
(x) => String(x.id) === this.editingBookmarkId,
|
||||
);
|
||||
const b = this.bookmarks.find((x) => String(x.id) === this.editingBookmarkId);
|
||||
if (!b) return;
|
||||
try {
|
||||
const resp = await fetch(
|
||||
@@ -585,10 +584,10 @@ Alpine.data("audioReader", () => ({
|
||||
|
||||
async deleteBookmark(b: Record<string, unknown>) {
|
||||
try {
|
||||
const resp = await fetch(
|
||||
`/api/media-items/${this.mediaItemId}/bookmarks/${b.id}`,
|
||||
{ method: "DELETE", headers: getAuthHeaders() },
|
||||
);
|
||||
const resp = await fetch(`/api/media-items/${this.mediaItemId}/bookmarks/${b.id}`, {
|
||||
method: "DELETE",
|
||||
headers: getAuthHeaders(),
|
||||
});
|
||||
if (!resp.ok) throw new Error("delete failed");
|
||||
await this.loadBookmarks();
|
||||
} catch {
|
||||
|
||||
Reference in new issue
Block a user