Initial commit
This commit is contained in:
37
src/App.tsx
Normal file
37
src/App.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { useEffect } from 'react';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { useAppStore } from './store/appStore';
|
||||
import AppShell from './components/layout/AppShell';
|
||||
import ConfigScreen from './components/config/ConfigScreen';
|
||||
|
||||
export default function App() {
|
||||
const { isConfigured, setIsConfigured, setUoRoot, setServuoScripts, setCenterMode } =
|
||||
useAppStore();
|
||||
|
||||
useEffect(() => {
|
||||
async function loadConfig() {
|
||||
try {
|
||||
const uo = await invoke<string | null>('get_config', { key: 'uo_root' });
|
||||
const scripts = await invoke<string | null>('get_config', { key: 'seruo_scripts' });
|
||||
|
||||
if (uo && scripts) {
|
||||
setUoRoot(uo);
|
||||
setServuoScripts(scripts);
|
||||
setIsConfigured(true);
|
||||
} else {
|
||||
setCenterMode('config');
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load config:', e);
|
||||
setCenterMode('config');
|
||||
}
|
||||
}
|
||||
loadConfig();
|
||||
}, []);
|
||||
|
||||
if (!isConfigured) {
|
||||
return <ConfigScreen />;
|
||||
}
|
||||
|
||||
return <AppShell />;
|
||||
}
|
||||
Reference in New Issue
Block a user