mirror of
https://github.com/SrIzan10/lofi.git
synced 2026-06-06 00:56:53 +00:00
style: some small fixes and code quality types
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
$effect(() => {
|
||||
if (video) {
|
||||
(appState as any).backgroundElement = video;
|
||||
appState.backgroundElement = video;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -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).';
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user