oops
This commit is contained in:
parent
a62b054e0b
commit
b59c85e108
2 changed files with 34 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
//js/app.js
|
//js/app.js
|
||||||
import { LosslessAPI } from './api.js';
|
import { LosslessAPI } from './api.js';
|
||||||
import { apiSettings, themeManager, nowPlayingSettings, downloadQualitySettings } from './storage.js';
|
import { apiSettings, themeManager, nowPlayingSettings, downloadQualitySettings, sidebarSettings } from './storage.js';
|
||||||
import { UIRenderer } from './ui.js';
|
import { UIRenderer } from './ui.js';
|
||||||
import { Player } from './player.js';
|
import { Player } from './player.js';
|
||||||
import { MultiScrobbler } from './multi-scrobbler.js';
|
import { MultiScrobbler } from './multi-scrobbler.js';
|
||||||
|
|
@ -313,6 +313,9 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
const currentTheme = themeManager.getTheme();
|
const currentTheme = themeManager.getTheme();
|
||||||
themeManager.setTheme(currentTheme);
|
themeManager.setTheme(currentTheme);
|
||||||
|
|
||||||
|
// Restore sidebar state
|
||||||
|
sidebarSettings.restoreState();
|
||||||
|
|
||||||
initializeSettings(scrobbler, player, api, ui);
|
initializeSettings(scrobbler, player, api, ui);
|
||||||
initializePlayerEvents(player, audioPlayer, scrobbler, ui);
|
initializePlayerEvents(player, audioPlayer, scrobbler, ui);
|
||||||
initializeTrackInteractions(
|
initializeTrackInteractions(
|
||||||
|
|
@ -405,6 +408,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||||
? '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>'
|
? '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>'
|
||||||
: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>';
|
: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>';
|
||||||
}
|
}
|
||||||
|
// Save sidebar state to localStorage
|
||||||
|
sidebarSettings.setCollapsed(isCollapsed);
|
||||||
});
|
});
|
||||||
|
|
||||||
document.getElementById('nav-back')?.addEventListener('click', () => {
|
document.getElementById('nav-back')?.addEventListener('click', () => {
|
||||||
|
|
|
||||||
|
|
@ -812,6 +812,34 @@ export const equalizerSettings = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const sidebarSettings = {
|
||||||
|
STORAGE_KEY: 'monochrome-sidebar-collapsed',
|
||||||
|
|
||||||
|
isCollapsed() {
|
||||||
|
try {
|
||||||
|
return localStorage.getItem(this.STORAGE_KEY) === 'true';
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
setCollapsed(collapsed) {
|
||||||
|
localStorage.setItem(this.STORAGE_KEY, collapsed ? 'true' : 'false');
|
||||||
|
},
|
||||||
|
|
||||||
|
restoreState() {
|
||||||
|
const isCollapsed = this.isCollapsed();
|
||||||
|
if (isCollapsed) {
|
||||||
|
document.body.classList.add('sidebar-collapsed');
|
||||||
|
const toggleBtn = document.getElementById('sidebar-toggle');
|
||||||
|
if (toggleBtn) {
|
||||||
|
toggleBtn.innerHTML =
|
||||||
|
'<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export const queueManager = {
|
export const queueManager = {
|
||||||
STORAGE_KEY: 'monochrome-queue',
|
STORAGE_KEY: 'monochrome-queue',
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue