diff --git a/src/App.tsx b/src/App.tsx index e03be31..432054d 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -19,6 +19,8 @@ function App() { const [playlists, setPlaylists] = useState([]); const [viewName, setViewName] = useState("Library"); const playlistsInfo= useRef([]); + const selectedSong = useRef(); + const setSelected = (props: SongProps) => {selectedSong.current = props;} const [nowPlaying, setNowPlaying] = useState(
- - + +
{ nowPlaying } @@ -113,14 +115,17 @@ interface PlaylistHeadProps { setViewName: React.Dispatch>, setLibrary: React.Dispatch>, playlistsInfo: MutableRefObject, -} + setSelected: (props: SongProps) => void, + } -function PlaylistHead({ playlists, setPlaylists, setViewName, setLibrary, playlistsInfo }: PlaylistHeadProps) { +function PlaylistHead({ playlists, setPlaylists, setViewName, setLibrary, playlistsInfo, setSelected }: PlaylistHeadProps) { function getPlaylist(playlist: PlaylistInfo) { invoke('get_playlist', { uuid: playlist.uuid }).then((list) => { + let i = 0; setLibrary([...(list as any[]).map((song) => { // console.log(song); const reload = () => getPlaylist(playlist) + i++; return ( ) })]) @@ -189,9 +196,10 @@ function PlaylistHead({ playlists, setPlaylists, setViewName, setLibrary, playli