Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyshankman committed Oct 31, 2024
1 parent 295e21d commit 2826310
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/renderer/components/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default function Main() {
const currentSongMetadata = usePlayerStore(
(store) => store.currentSongMetadata,
);
const setCurrentSong = usePlayerStore((store) => store.setCurrentSong);
const filteredLibrary = usePlayerStore((store) => store.filteredLibrary);
const setFilteredLibrary = usePlayerStore(
(store) => store.setFilteredLibrary,
Expand All @@ -58,9 +59,6 @@ export default function Main() {
const setOverrideScrollToIndex = usePlayerStore(
(store) => store.setOverrideScrollToIndex,
);
const setCurrentSongWithDetails = usePlayerStore(
(store) => store.setCurrentSong,
);

/**
* @dev JSX refs
Expand Down Expand Up @@ -122,7 +120,7 @@ export default function Main() {
});
}

setCurrentSongWithDetails(song, storeLibrary);
setCurrentSong(song, storeLibrary);

// @dev: send message that syncs the BE with the FE
// that way on next boot we can restore the last played song
Expand Down Expand Up @@ -150,7 +148,7 @@ export default function Main() {
const startCurrentSongOver = async () => {
return new Promise((resolve, reject) => {
if (currentSong && currentSongMetadata) {
setCurrentSongWithDetails('', filteredLibrary);
setCurrentSong('', filteredLibrary);
window.setTimeout(() => {
playSong(currentSong, currentSongMetadata);
resolve(null);
Expand Down Expand Up @@ -289,7 +287,7 @@ export default function Main() {

// set current song to the first song in the library
const firstSong = Object.keys(arg.library)[0];
setCurrentSongWithDetails(firstSong, storeLibrary);
setCurrentSong(firstSong, storeLibrary);

setPaused(true);
setInitialScrollIndex(2);
Expand Down Expand Up @@ -324,7 +322,7 @@ export default function Main() {
setFilteredLibrary(arg.library);

if (arg.lastPlayedSong) {
setCurrentSongWithDetails(arg.lastPlayedSong, storeLibrary);
setCurrentSong(arg.lastPlayedSong, storeLibrary);

// now find the index of the song within the library
const songIndex = Object.keys(arg.library).findIndex(
Expand Down

0 comments on commit 2826310

Please sign in to comment.