import { createRoot } from "react-dom/client";
import { Provider } from "react-redux";

import { store } from "./store";
import MusicPlayer from "./MusicPlayer";
import { setSource, setTitle } from "./store/music/types";
// @ts-ignore - mp3 files have no types.
import mseq from "./Mseq_-_Journey.mp3";

const rootElement = document.getElementById("playerUI");

const root = createRoot(rootElement!);
root.render(
    <Provider store={store}>
        <MusicPlayer />
    </Provider>
);

store.dispatch(setSource(mseq));
store.dispatch(
    setTitle({
        name: "Journey",
        artist: "Mseq",
        album: "Unknown album",
        length: 192052244,
    })
);
