FEAT: Create basic model embed (#588)
* initial commit, issue with OpenSCAD embed viewing * initial implementation * Fix openscad size bug * Add overlays to embed * Remove console.log and reuse exact query Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit was merged in pull request #588.
This commit is contained in:
31
app/web/src/components/EmbedProject/EmbedProject.tsx
Normal file
31
app/web/src/components/EmbedProject/EmbedProject.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import Seo from 'src/components/Seo/Seo'
|
||||
import IdeViewer from 'src/components/IdeViewer/IdeViewer'
|
||||
import { useIdeState } from 'src/helpers/hooks/useIdeState'
|
||||
import type { Project } from 'src/components/EmbedProjectCell/EmbedProjectCell'
|
||||
import { IdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||
import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
|
||||
interface Props {
|
||||
project?: Project
|
||||
}
|
||||
|
||||
const EmbedProject = ({ project }: Props) => {
|
||||
const [state, thunkDispatch] = useIdeState()
|
||||
const { viewerDomRef, handleViewerSizeUpdate } = use3dViewerResize()
|
||||
|
||||
useEffect(() => {
|
||||
handleViewerSizeUpdate()
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-screen" ref={viewerDomRef} >
|
||||
<IdeContext.Provider value={{ state, thunkDispatch, project }}>
|
||||
<IdeViewer />
|
||||
</IdeContext.Provider>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default EmbedProject
|
||||
Reference in New Issue
Block a user