Initial Commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { useEffect } from "react"
|
||||
import { useLocation, useNavigate, useRoutes } from "react-router-dom"
|
||||
import { routes } from "./routes"
|
||||
import { ErrorBoundary } from "./shared/components/ErrorBoundary"
|
||||
import { initBridgeNavigate, setBridgeNavigate } from "@/lib/bridge/bridgeNavigate"
|
||||
import { reportRoute } from "@/lib/bridge/webviewBridge"
|
||||
import { DesktopWindowFrame } from "@/shared/components/DesktopWindowFrame"
|
||||
|
||||
export default function App() {
|
||||
const element = useRoutes(routes)
|
||||
const navigate = useNavigate()
|
||||
const location = useLocation()
|
||||
|
||||
// C#가 navigate 푸시(예: Ctrl+Shift+7 → /snippet)를 보내면 이 콜백으로 라우팅.
|
||||
useEffect(() => {
|
||||
setBridgeNavigate(navigate)
|
||||
initBridgeNavigate()
|
||||
return () => setBridgeNavigate(null)
|
||||
}, [navigate])
|
||||
|
||||
// route 바뀔 때마다 호스트에 보고 — C#가 마지막 챗봇 위치 기억(Ctrl+Shift+8 복귀용).
|
||||
useEffect(() => {
|
||||
reportRoute(location.pathname)
|
||||
}, [location.pathname])
|
||||
|
||||
return (
|
||||
<DesktopWindowFrame>
|
||||
<ErrorBoundary>{element}</ErrorBoundary>
|
||||
</DesktopWindowFrame>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user