// Root.jsx
import { toast } from 'react-toastify';
import { API_URL } from '../config';
import { Player } from './AudioPlayer.jsx';
import { JoyUIRootIsland } from './Components.jsx';
import { PrimeReactProvider } from "primereact/api";
import CustomToastContainer from '../components/ToastProvider.jsx';
import LyricSearch from './LyricSearch.jsx';
import 'primereact/resources/themes/bootstrap4-light-blue/theme.css';
import 'primereact/resources/primereact.min.css';

export default function Root({child}) {
  window.toast = toast;
  window.API_URL = API_URL;
  const theme = document.documentElement.getAttribute("data-theme")
  // console.log(opts.children);
  return (
    <PrimeReactProvider>
    <CustomToastContainer
    theme={theme}
    newestOnTop={true}
    closeOnClick={true}/>
    <JoyUIRootIsland>
    {/* <Alert
        className="alert"
        startDecorator={<WarningIcon />}
        variant="soft"
        color="danger">
          Work in progress... bugs are to be expected.
        </Alert> */}
    {child == "LyricSearch" && (<LyricSearch client:only="react" />)}
    {child == "Player" && (<Player client:only="react"></Player>)}
    </JoyUIRootIsland>
    </PrimeReactProvider>
  );
}

