2024-08-29 16:59:25 +08:00
|
|
|
import { ThemeProvider } from "@/components/theme-provider";
|
|
|
|
import LayoutMain from "@/pages/Layout";
|
2024-09-03 16:40:09 +08:00
|
|
|
import { HashRouter as Router, Routes, Route } from "react-router-dom";
|
2024-08-29 16:59:25 +08:00
|
|
|
import Boot from "@/pages/Boot";
|
|
|
|
import { Setting } from "./pages/Setting";
|
|
|
|
import { useEffect } from "react";
|
|
|
|
import { Models } from "./pages/Models";
|
|
|
|
import { Tools } from "./pages/Tools";
|
|
|
|
import { Datasource } from "./pages/Datasource";
|
|
|
|
|
|
|
|
function App() {
|
|
|
|
const theme = document.querySelector("html")!.getAttribute("theme") as
|
|
|
|
| "dark"
|
|
|
|
| "light";
|
|
|
|
|
2024-09-06 14:27:41 +08:00
|
|
|
/**
|
|
|
|
* 等待渲染完成再显示窗口
|
|
|
|
*/
|
2024-08-29 16:59:25 +08:00
|
|
|
useEffect(() => {
|
|
|
|
window.ipcRenderer.send("ipc-loaded");
|
2024-09-06 14:27:41 +08:00
|
|
|
return () => {
|
|
|
|
window.ipcRenderer.off("ipc-loaded", () => {});
|
|
|
|
};
|
2024-08-29 16:59:25 +08:00
|
|
|
}, []);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ThemeProvider defaultTheme={theme} storageKey="vite-ui-theme">
|
|
|
|
<Router>
|
|
|
|
<Routes>
|
|
|
|
<Route path="/" element={<LayoutMain />}>
|
|
|
|
<Route index element={<Boot />} />
|
|
|
|
<Route path="models" element={<Models />} />
|
|
|
|
<Route path="datasource" element={<Datasource />} />
|
|
|
|
<Route path="tools" element={<Tools />} />
|
|
|
|
<Route path="setting" element={<Setting />} />
|
|
|
|
</Route>
|
|
|
|
</Routes>
|
|
|
|
</Router>
|
|
|
|
</ThemeProvider>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default App;
|