// Admin App router.

function AdminApp(){
  const [route, setRoute] = React.useState('dash');

  React.useEffect(()=>{ window.scrollTo(0,0); }, [route]);

  let View;
  if(route==='dash')          View = window.Dashboard;
  else if(route==='pubcrm')   View = window.PublisherCRM;
  else if(route==='pubintel') View = window.PublisherIntel;
  else if(route==='creators') View = window.CreatorCRM;
  else if(route==='acq')      View = window.Acquisition;
  else if(route==='desk')     View = window.ContentDesk;
  else if(route==='studio')   View = window.EditorialStudio;
  else if(route==='reqs')     View = window.ArticleRequests;
  else if(route==='nl')       View = window.Newsletter;
  else if(route==='ads')      View = window.AdOps;
  else if(route==='rev')      View = window.Revenue;
  else if(route==='onb')      View = window.Onboarding;
  else                        View = window.Dashboard;

  return <View setRoute={setRoute}/>;
}

ReactDOM.createRoot(document.getElementById('root')).render(<AdminApp/>);
