Skip to content

Commit 3582e9b

Browse files
style: apply deno fmt formatting to frontend JS
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a88d16c commit 3582e9b

6 files changed

Lines changed: 118 additions & 35 deletions

File tree

app/frontend/js/components/library-browser.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ export function createLibraryBrowser(Alpine) {
8686
wasColumnDragging: false,
8787

8888
// Type-to-jump state
89-
_typeBuffer: '', // Accumulated typed characters
90-
_typeDebounceTimer: null, // Timeout ID for clearing buffer
91-
_cycleChar: '', // Character being cycled (single letter repeat)
92-
_cycleIndex: -1, // Index into distinct matching artists for cycling
89+
_typeBuffer: '', // Accumulated typed characters
90+
_typeDebounceTimer: null, // Timeout ID for clearing buffer
91+
_cycleChar: '', // Character being cycled (single letter repeat)
92+
_cycleIndex: -1, // Index into distinct matching artists for cycling
9393

9494
containerWidth: 0,
9595
resizeObserver: null,
@@ -1783,7 +1783,8 @@ export function createLibraryBrowser(Alpine) {
17831783

17841784
isInPlaylistView() {
17851785
// Check the library store directly for reliability (avoids event timing issues)
1786-
return this.$store.library.currentSection?.startsWith('playlist-') || this.currentPlaylistId !== null;
1786+
return this.$store.library.currentSection?.startsWith('playlist-') ||
1787+
this.currentPlaylistId !== null;
17871788
},
17881789

17891790
startPlaylistDrag(index, event) {
@@ -1916,7 +1917,9 @@ export function createLibraryBrowser(Alpine) {
19161917
const wouldReorder = this.draggingIndex !== adjustedToPosition;
19171918

19181919
// Show indicator ABOVE this row if dragOverIndex equals this row's index
1919-
if (wouldReorder && index === this.dragOverIndex && this.dragOverIndex !== this.draggingIndex) {
1920+
if (
1921+
wouldReorder && index === this.dragOverIndex && this.dragOverIndex !== this.draggingIndex
1922+
) {
19201923
classes.push('playlist-drop-indicator-above');
19211924
}
19221925
// Show indicator BELOW the last row if dragging to the end

app/frontend/js/components/settings-view.js

Lines changed: 76 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { api } from '../api.js';
2-
import { SHORTCUT_DEFINITIONS, modLabel } from '../shortcuts.js';
2+
import { modLabel, SHORTCUT_DEFINITIONS } from '../shortcuts.js';
33

44
export function createSettingsView(Alpine) {
55
Alpine.data('settingsView', () => ({
@@ -538,15 +538,36 @@ export function createSettingsView(Alpine) {
538538
loadColumnSettings() {
539539
// Default column order for comparison
540540
const defaultOrder = [
541-
'status', 'index', 'title', 'artist', 'album', 'year', 'duration',
542-
'lastPlayed', 'dateAdded', 'playCount', 'genre', 'trackTotal', 'discNumber',
541+
'status',
542+
'index',
543+
'title',
544+
'artist',
545+
'album',
546+
'year',
547+
'duration',
548+
'lastPlayed',
549+
'dateAdded',
550+
'playCount',
551+
'genre',
552+
'trackTotal',
553+
'discNumber',
543554
];
544555

545556
// Default visibility
546557
const defaultVisibility = {
547-
status: true, index: true, title: true, artist: true, album: true,
548-
year: true, genre: false, trackTotal: false, discNumber: false,
549-
lastPlayed: true, dateAdded: true, playCount: true, duration: true,
558+
status: true,
559+
index: true,
560+
title: true,
561+
artist: true,
562+
album: true,
563+
year: true,
564+
genre: false,
565+
trackTotal: false,
566+
discNumber: false,
567+
lastPlayed: true,
568+
dateAdded: true,
569+
playCount: true,
570+
duration: true,
550571
};
551572

552573
if (window.settings?.initialized) {
@@ -625,18 +646,49 @@ export function createSettingsView(Alpine) {
625646

626647
// Default values for reset (must match DEFAULT_COLUMN_WIDTHS in library-browser.js)
627648
const defaultWidths = {
628-
status: 24, index: 48, title: 320, artist: 431, album: 411, year: 70,
629-
genre: 120, trackTotal: 60, discNumber: 60, lastPlayed: 120,
630-
dateAdded: 120, playCount: 83, duration: 52,
649+
status: 24,
650+
index: 48,
651+
title: 320,
652+
artist: 431,
653+
album: 411,
654+
year: 70,
655+
genre: 120,
656+
trackTotal: 60,
657+
discNumber: 60,
658+
lastPlayed: 120,
659+
dateAdded: 120,
660+
playCount: 83,
661+
duration: 52,
631662
};
632663
const defaultOrder = [
633-
'status', 'index', 'title', 'artist', 'album', 'year', 'duration',
634-
'lastPlayed', 'dateAdded', 'playCount', 'genre', 'trackTotal', 'discNumber',
664+
'status',
665+
'index',
666+
'title',
667+
'artist',
668+
'album',
669+
'year',
670+
'duration',
671+
'lastPlayed',
672+
'dateAdded',
673+
'playCount',
674+
'genre',
675+
'trackTotal',
676+
'discNumber',
635677
];
636678
const defaultVisibility = {
637-
status: true, index: true, title: true, artist: true, album: true,
638-
year: true, genre: false, trackTotal: false, discNumber: false,
639-
lastPlayed: true, dateAdded: true, playCount: true, duration: true,
679+
status: true,
680+
index: true,
681+
title: true,
682+
artist: true,
683+
album: true,
684+
year: true,
685+
genre: false,
686+
trackTotal: false,
687+
discNumber: false,
688+
lastPlayed: true,
689+
dateAdded: true,
690+
playCount: true,
691+
duration: true,
640692
};
641693

642694
try {
@@ -685,11 +737,17 @@ export function createShortcutsSettings(Alpine) {
685737

686738
Alpine.data('shortcutsSettings', () => ({
687739
playback: all.filter((s) =>
688-
['Play / Pause', 'Next track', 'Seek forward 5s', 'Previous track', 'Seek back 5s', 'Cycle loop mode', 'Toggle shuffle'].includes(s.action)
689-
),
690-
volume: all.filter((s) =>
691-
['Volume up', 'Volume down', 'Mute / Unmute'].includes(s.action)
740+
[
741+
'Play / Pause',
742+
'Next track',
743+
'Seek forward 5s',
744+
'Previous track',
745+
'Seek back 5s',
746+
'Cycle loop mode',
747+
'Toggle shuffle',
748+
].includes(s.action)
692749
),
750+
volume: all.filter((s) => ['Volume up', 'Volume down', 'Mute / Unmute'].includes(s.action)),
693751
navigation: all.filter((s) =>
694752
['Focus search', 'Clear search / Close dialogs', 'Toggle settings'].includes(s.action)
695753
),

app/frontend/js/constants.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
*/
44

55
/** Default list of words to ignore when sorting (articles in various languages) */
6-
export const DEFAULT_SORT_IGNORE_WORDS = 'the, a, an, la, le, les, los, las, el, die, der, das, il, lo, gli, ...';
6+
export const DEFAULT_SORT_IGNORE_WORDS =
7+
'the, a, an, la, le, les, los, las, el, die, der, das, il, lo, gli, ...';

app/frontend/js/stores/library.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,8 @@ export function createLibraryStore(Alpine) {
156156

157157
for (const [section, data] of Object.entries(cached)) {
158158
// Accept standard sections or playlist-* sections
159-
const isValidSection = validSections.includes(section) || section.startsWith('playlist-');
159+
const isValidSection = validSections.includes(section) ||
160+
section.startsWith('playlist-');
160161
if (isValidSection && data?.totalTracks > 0) {
161162
// Strip any legacy tracks array from persisted cache to save memory
162163
const { tracks: _tracks, ...summary } = data;
@@ -170,7 +171,7 @@ export function createLibraryStore(Alpine) {
170171
sections: Object.keys(this._sectionCache),
171172
totalTracks: Object.values(this._sectionCache).reduce(
172173
(sum, s) => sum + (s.totalTracks || 0),
173-
0
174+
0,
174175
),
175176
});
176177
return true;
@@ -350,7 +351,9 @@ export function createLibraryStore(Alpine) {
350351

351352
// Show cached summary stats if available (previous tracks stay visible during fetch)
352353
if (cached) {
353-
console.log('[library]', 'loadFavorites_with_cache_summary', { totalTracks: cached.totalTracks });
354+
console.log('[library]', 'loadFavorites_with_cache_summary', {
355+
totalTracks: cached.totalTracks,
356+
});
354357
this.totalTracks = cached.totalTracks;
355358
this.totalDuration = cached.totalDuration;
356359
this._lastLoadedSection = section;
@@ -400,7 +403,9 @@ export function createLibraryStore(Alpine) {
400403

401404
// Show cached summary stats if available (previous tracks stay visible during fetch)
402405
if (cached) {
403-
console.log('[library]', 'loadRecentlyPlayed_with_cache_summary', { totalTracks: cached.totalTracks });
406+
console.log('[library]', 'loadRecentlyPlayed_with_cache_summary', {
407+
totalTracks: cached.totalTracks,
408+
});
404409
this.totalTracks = cached.totalTracks;
405410
this.totalDuration = cached.totalDuration;
406411
this._lastLoadedSection = section;
@@ -450,7 +455,9 @@ export function createLibraryStore(Alpine) {
450455

451456
// Show cached summary stats if available (previous tracks stay visible during fetch)
452457
if (cached) {
453-
console.log('[library]', 'loadRecentlyAdded_with_cache_summary', { totalTracks: cached.totalTracks });
458+
console.log('[library]', 'loadRecentlyAdded_with_cache_summary', {
459+
totalTracks: cached.totalTracks,
460+
});
454461
this.totalTracks = cached.totalTracks;
455462
this.totalDuration = cached.totalDuration;
456463
this._lastLoadedSection = section;
@@ -500,7 +507,9 @@ export function createLibraryStore(Alpine) {
500507

501508
// Show cached summary stats if available (previous tracks stay visible during fetch)
502509
if (cached) {
503-
console.log('[library]', 'loadTop25_with_cache_summary', { totalTracks: cached.totalTracks });
510+
console.log('[library]', 'loadTop25_with_cache_summary', {
511+
totalTracks: cached.totalTracks,
512+
});
504513
this.totalTracks = cached.totalTracks;
505514
this.totalDuration = cached.totalDuration;
506515
this._lastLoadedSection = section;
@@ -768,8 +777,10 @@ export function createLibraryStore(Alpine) {
768777

769778
// Tiebreaker 4: Artist (if not primary sort key)
770779
if (sortKey !== 'artist') {
771-
const aArtist = this._stripIgnoredPrefix(a.album_artist || a.artist || '', ignoreWords).toLowerCase();
772-
const bArtist = this._stripIgnoredPrefix(b.album_artist || b.artist || '', ignoreWords).toLowerCase();
780+
const aArtist = this._stripIgnoredPrefix(a.album_artist || a.artist || '', ignoreWords)
781+
.toLowerCase();
782+
const bArtist = this._stripIgnoredPrefix(b.album_artist || b.artist || '', ignoreWords)
783+
.toLowerCase();
773784
if (aArtist < bArtist) return -1;
774785
if (aArtist > bArtist) return 1;
775786
}

app/frontend/js/stores/queue.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ export function createQueueStore(Alpine) {
273273

274274
// Append after any previously queued-next tracks (not before them)
275275
if (!this._playNextOffset) this._playNextOffset = 0;
276-
const insertIndex = (this.currentIndex >= 0 ? this.currentIndex + 1 : 0) + this._playNextOffset;
276+
const insertIndex = (this.currentIndex >= 0 ? this.currentIndex + 1 : 0) +
277+
this._playNextOffset;
277278

278279
console.log('[queue]', 'play_next_tracks', {
279280
count: tracksArray.length,

app/frontend/js/stores/ui.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,16 @@ export function createUIStore(Alpine) {
154154

155155
setSettingsSection(section) {
156156
if (
157-
['general', 'library', 'appearance', 'columns', 'shortcuts', 'sorting', 'advanced', 'lastfm'].includes(
157+
[
158+
'general',
159+
'library',
160+
'appearance',
161+
'columns',
162+
'shortcuts',
163+
'sorting',
164+
'advanced',
165+
'lastfm',
166+
].includes(
158167
section,
159168
)
160169
) {

0 commit comments

Comments
 (0)