Files
tkmind_go/ui/desktop/src/renderer.tsx
T
Abhijay Jain 0a4cf49064 feat(ui): bring back quick launcher (#5144)
Signed-off-by: Abhijay007 <Abhijay007j@gmail.com>
Co-authored-by: Alex Hancock <alexhancock@block.xyz>
2025-11-06 10:35:31 -05:00

43 lines
1.3 KiB
TypeScript

import React, { Suspense, lazy } from 'react';
import ReactDOM from 'react-dom/client';
import { ConfigProvider } from './components/ConfigContext';
import { ErrorBoundary } from './components/ErrorBoundary';
import SuspenseLoader from './suspense-loader';
import { client } from './api/client.gen';
const App = lazy(() => import('./App'));
(async () => {
// Check if we're in the launcher view (doesn't need goosed connection)
const isLauncher = window.location.hash === '#/launcher';
if (!isLauncher) {
console.log('window created, getting goosed connection info');
const baseUrl = await window.electron.getGoosedHostPort();
if (baseUrl === null) {
window.alert('failed to start goose backend process');
return;
}
console.log('connecting at', baseUrl);
client.setConfig({
baseUrl,
headers: {
'Content-Type': 'application/json',
'X-Secret-Key': await window.electron.getSecretKey(),
},
});
}
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<Suspense fallback={SuspenseLoader()}>
<ConfigProvider>
<ErrorBoundary>
<App />
</ErrorBoundary>
</ConfigProvider>
</Suspense>
</React.StrictMode>
);
})();