Adds window.__pascalScene = useScene in development builds so that a
running MCP process (which has its own Node-side in-memory store) can
inject a built scene into the browser editor for visual verification:
fetch('/dev/casa-sol.json')
.then(r => r.json())
.then(s => window.__pascalScene.getState().setScene(s.nodes, s.rootNodeIds))
Also ships /public/dev/casa-sol.json as a reference scene — the
artefact exported from the MCP Casa del Sol test build.
Gated behind NODE_ENV !== 'production' so nothing leaks to prod.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
38 lines
988 B
TypeScript
38 lines
988 B
TypeScript
'use client'
|
|
|
|
import {
|
|
Editor,
|
|
type SidebarTab,
|
|
ViewerToolbarLeft,
|
|
ViewerToolbarRight,
|
|
} from '@pascal-app/editor'
|
|
import { useScene } from '@pascal-app/core'
|
|
|
|
// Dev-only: expose the scene store on window so MCP can inject a built
|
|
// scene into the running editor for visual verification. No-op in prod.
|
|
if (typeof window !== 'undefined' && process.env.NODE_ENV !== 'production') {
|
|
;(window as unknown as { __pascalScene?: typeof useScene }).__pascalScene = useScene
|
|
}
|
|
|
|
const SIDEBAR_TABS: (SidebarTab & { component: React.ComponentType })[] = [
|
|
{
|
|
id: 'site',
|
|
label: 'Scene',
|
|
component: () => null, // Built-in SitePanel handles this
|
|
},
|
|
]
|
|
|
|
export default function Home() {
|
|
return (
|
|
<div className="h-screen w-screen">
|
|
<Editor
|
|
layoutVersion="v2"
|
|
projectId="local-editor"
|
|
sidebarTabs={SIDEBAR_TABS}
|
|
viewerToolbarLeft={<ViewerToolbarLeft />}
|
|
viewerToolbarRight={<ViewerToolbarRight />}
|
|
/>
|
|
</div>
|
|
)
|
|
}
|