style: some small fixes and code quality types

This commit is contained in:
2025-04-25 19:39:57 +00:00
parent 431b1bbe6a
commit 75de5de11c
5 changed files with 13 additions and 13 deletions

View File

@@ -8,7 +8,7 @@
$effect(() => {
appState.currentBackgroundId = selectedBackgroundId;
window.localStorage.setItem('backgroundId', selectedBackgroundId);
console.log('Background changed to:', selectedBackgroundId);
console.log('background changed to:', selectedBackgroundId);
})
</script>

View File

@@ -5,7 +5,7 @@
$effect(() => {
if (video) {
(appState as any).backgroundElement = video;
appState.backgroundElement = video;
}
});

View File

@@ -14,9 +14,9 @@
if (appState.backgroundElement) {
if (play) {
(appState.backgroundElement as HTMLVideoElement).play().catch(e => console.error('Error playing background video:', e));
appState.backgroundElement.play().catch(e => console.error('Error playing background video:', e));
} else {
(appState.backgroundElement as HTMLVideoElement).pause();
appState.backgroundElement.pause();
}
}
@@ -107,22 +107,22 @@
}
if (data.stations.length > 0) {
const storedStationId = window.localStorage.getItem('StationId');
const storedStationId = window.localStorage.getItem('stationId');
if (storedStationId && data.stations.some(station => station.id.toString() === storedStationId)) {
appState.currentStation = parseInt(storedStationId, 10);
appState.currentStation = parseInt(storedStationId, 10);
} else {
appState.currentStation = data.stations[0].id;
appState.currentStation = data.stations[0].id;
}
console.log('Current station ID:', appState.currentStation);
console.log('current station ID:', appState.currentStation);
}
if (appState.backgrounds.length > 0) {
const storedBackgroundId = window.localStorage.getItem('backgroundId');
if (storedBackgroundId && appState.backgrounds.some(bg => bg.id === storedBackgroundId)) {
appState.currentBackgroundId = storedBackgroundId;
appState.currentBackgroundId = storedBackgroundId;
} else {
appState.currentBackgroundId = appState.backgrounds[0].id;
appState.currentBackgroundId = appState.backgrounds[0].id;
}
console.log('Current background ID:', appState.currentBackgroundId);
console.log('current background ID:', appState.currentBackgroundId);
} else {
appState.error = 'Failed to load initial data (empty response).';
}

View File

@@ -8,7 +8,7 @@
$effect(() => {
if (selectedStationId) {
appState.currentStation = parseInt(selectedStationId);
window.localStorage.setItem('StationId', selectedStationId);
window.localStorage.setItem('stationId', selectedStationId);
console.log('Station changed to:', selectedStationId);
}
});

View File

@@ -9,7 +9,7 @@ export const state = $state({
volume: 0.5,
isMuted: false,
currentBackgroundId: null as string | null,
backgroundElement: null,
backgroundElement: null as HTMLVideoElement | null,
activeAtmospheres: {} as Record<string, number>, // { atmosphereId: volume (0-100) }
isLoading: true,
error: null as string | null,