mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 11:37:47 +01:00
* refactor: replace `getCurrentWindow` with `getCurrentWebviewWindow` * refactor: update * refactor: update
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { useEffect } from "react";
|
|
|
|
import SearchChat from "@/components/SearchChat";
|
|
import { useAppStore } from "@/stores/appStore";
|
|
import { useSyncStore } from "@/hooks/useSyncStore";
|
|
import UpdateApp from "@/components/UpdateApp";
|
|
import Synthesize from "@/components/Assistant/Synthesize";
|
|
import { useChatStore } from "@/stores/chatStore";
|
|
import { useSearchStore } from "@/stores/searchStore";
|
|
import platformAdapter from "@/utils/platformAdapter";
|
|
|
|
function MainApp() {
|
|
const { setIsTauri } = useAppStore();
|
|
const { setViewExtensionOpened } = useSearchStore();
|
|
|
|
useEffect(() => {
|
|
setIsTauri(true);
|
|
|
|
// Set up the listener that listens for "open_view_extension" events
|
|
//
|
|
// Events will be sent when users try to open a View extension via hotkey,
|
|
// whose payload contains the needed information to load the View page.
|
|
platformAdapter.listenEvent("open_view_extension", async ({ payload }) => {
|
|
await platformAdapter.showWindow();
|
|
|
|
setViewExtensionOpened(payload);
|
|
});
|
|
}, []);
|
|
|
|
const { synthesizeItem } = useChatStore();
|
|
|
|
useSyncStore();
|
|
|
|
return (
|
|
<>
|
|
<SearchChat isTauri={true} hasModules={["search", "chat"]} />
|
|
<UpdateApp />
|
|
|
|
{synthesizeItem && <Synthesize />}
|
|
</>
|
|
);
|
|
}
|
|
|
|
export default MainApp;
|