Files
proxycast/src/RootRouter.tsx
T

39 lines
979 B
TypeScript

/**
* @file RootRouter.tsx
* @description 根路由组件 - 根据 URL 路径渲染对应的组件
*/
import App from "./App";
import { SmartInputPage } from "./pages/smart-input";
import { UpdateNotificationPage } from "./pages/update-notification";
import { Toaster } from "./components/ui/sonner";
/**
* 根据 URL 路径渲染对应的组件
*
* - /smart-input: 截图对话悬浮窗口(独立 Tauri 窗口,支持语音模式)
* - /update-notification: 更新提醒悬浮窗口(独立 Tauri 窗口)
* - 其他: 主应用
*/
export function RootRouter() {
const pathname = window.location.pathname;
// 截图对话悬浮窗口路由(也用于语音输入)
if (pathname === "/smart-input") {
return <SmartInputPage />;
}
// 更新提醒悬浮窗口路由
if (pathname === "/update-notification") {
return <UpdateNotificationPage />;
}
// 默认渲染主应用
return (
<>
<App />
<Toaster />
</>
);
}