import { StrictMode, useEffect } from 'react';
import { createRoot } from 'react-dom/client';
import { WorkspaceShell } from '@/features/workspace/WorkspaceShell';
import { startAuthPolling, useWorkbenchStore } from '@/features/workspace/WorkspaceStore';
import '@/styles/workbench.css';

function App() {
  const bootstrap = useWorkbenchStore((s) => s.bootstrap);

  useEffect(() => {
    void bootstrap();
    startAuthPolling();
  }, [bootstrap]);

  return <WorkspaceShell />;
}

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <App />
  </StrictMode>,
);
