-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add splashscreen and load settings and project structure before app r…
…enders Note that the webkit white background is a pending tauri issue: tauri-apps/tauri#1564
- Loading branch information
Showing
7 changed files
with
91 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
</head> | ||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/splash.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,54 @@ | ||
import './index.css'; | ||
|
||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { invoke } from '@tauri-apps/api'; | ||
import { Provider } from 'jotai'; | ||
import React from 'react'; | ||
import React, { useState } from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
|
||
import App from './application/App'; | ||
import { useAsyncEffect } from './hooks/useAsyncEffect'; | ||
import { ensureProjectFileStructure } from './io/filesystem'; | ||
import { noop } from './lib/noop'; | ||
import { notifyInfo } from './notifications/notifications'; | ||
import { interceptConsoleMessages } from './notifications/notifications.console'; | ||
import { initSettings } from './settings/settingsManager'; | ||
|
||
const queryClient = new QueryClient(); | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<Provider> | ||
<QueryClientProvider client={queryClient}> | ||
<App /> | ||
<AppStartup /> | ||
</QueryClientProvider> | ||
</Provider> | ||
</React.StrictMode>, | ||
); | ||
|
||
function AppStartup() { | ||
const [initialized, setInitialized] = useState(false); | ||
|
||
useAsyncEffect( | ||
async () => { | ||
// Note: Intercepting INFO, WARN and ERROR console.* | ||
interceptConsoleMessages(true, true, true); | ||
|
||
notifyInfo('Application Startup'); | ||
await initSettings(); | ||
await ensureProjectFileStructure(); | ||
await invoke('close_splashscreen'); | ||
notifyInfo('Application Initialized'); | ||
|
||
setInitialized(true); | ||
}, | ||
noop, | ||
[setInitialized], | ||
); | ||
|
||
if (!initialized) { | ||
return null; | ||
} | ||
|
||
return <App />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import './index.css'; | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
|
||
import { WelcomeView } from './application/views/WelcomeView'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root')!).render( | ||
<React.StrictMode> | ||
<WelcomeView className="h-screen bg-white" hideShortcuts /> | ||
</React.StrictMode>, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters