FEAT: Create basic model embed #588
@@ -5,7 +5,7 @@ datasource db {
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
binaryTargets = "native"
|
||||
binaryTargets = ["native", "darwin-arm64", "darwin"]
|
||||
}
|
||||
|
||||
// sqlLight does not suport enums so we can't use enums until we set up postgresql in dev mode
|
||||
|
||||
@@ -68,4 +68,4 @@ export const Success = ({
|
||||
|
|
||||
<EmbedProject project={project} />
|
||||
</IdeContext.Provider>
|
||||
)
|
||||
}
|
||||
|
You should be able to import than re export QUERY from You should be able to import than re export QUERY from `app/web/src/components/IdeProjectCell/IdeProjectCell.tsx` instead of redefining it here (can import the Project type too)
I don't mind having some duplication, but having more than one query with the same name `FIND_PROJECT_BY_USENAME_TITLE` can cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.
Ah nice thank you, complete. Ah nice thank you, complete.
|
||||
}
|
||||
|
You should be able to import than re export QUERY from You should be able to import than re export QUERY from `app/web/src/components/IdeProjectCell/IdeProjectCell.tsx` instead of redefining it here (can import the Project type too)
I don't mind having some duplication, but having more than one query with the same name `FIND_PROJECT_BY_USENAME_TITLE` can cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.
Ah nice thank you, complete. Ah nice thank you, complete.
|
||||
|
||||
|
You should be able to import than re export QUERY from You should be able to import than re export QUERY from `app/web/src/components/IdeProjectCell/IdeProjectCell.tsx` instead of redefining it here (can import the Project type too)
I don't mind having some duplication, but having more than one query with the same name `FIND_PROJECT_BY_USENAME_TITLE` can cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.
You should be able to import than re export QUERY from You should be able to import than re export QUERY from `app/web/src/components/IdeProjectCell/IdeProjectCell.tsx` instead of redefining it here (can import the Project type too)
I don't mind having some duplication, but having more than one query with the same name `FIND_PROJECT_BY_USENAME_TITLE` can cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.
Ah nice thank you, complete. Ah nice thank you, complete.
Ah nice thank you, complete. Ah nice thank you, complete.
|
||||
19
app/web/src/components/EmbedViewer/EmbedViewer.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import { useIdeInit } from 'src/components/EncodedUrl/helpers'
|
||||
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||
import IdeViewer from 'src/components/IdeViewer/IdeViewer'
|
||||
import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
|
||||
|
||||
function EmbedViewer() {
|
||||
const { state, project } = useIdeContext()
|
||||
console.log('from EmbedViewer', { cadPackage: project.cadPackage, code: project.code })
|
||||
useIdeInit(project?.cadPackage, project?.code || state?.code, "viewer")
|
||||
const { viewerDomRef } = use3dViewerResize()
|
||||
|
||||
return (
|
||||
<div className="h-screen flex flex-col">
|
||||
<IdeViewer isMinimal={true} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default EmbedViewer
|
||||
@@ -4,8 +4,10 @@ import { PureIdeViewer } from './PureIdeViewer'
|
||||
|
||||
const IdeViewer = ({
|
||||
handleOwnCamera = false,
|
||||
isMinimal = false,
|
||||
}: {
|
||||
handleOwnCamera?: boolean
|
||||
handleOwnCamera?: boolean,
|
||||
isMinimal?: boolean,
|
||||
}) => {
|
||||
const { state, thunkDispatch } = useIdeContext()
|
||||
const dataType = state.objectData?.type
|
||||
@@ -41,7 +43,7 @@ const IdeViewer = ({
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<PureIdeViewer
|
||||
dataType={dataType}
|
||||
|
||||
@@ -52,6 +52,7 @@ const ProjectProfile = ({
|
||||
})
|
||||
)
|
||||
}, [currentUser, project?.title, userProject.userName])
|
||||
console.log('from ProjectProfile', { cadPackage: project.cadPackage, code: project.code })
|
||||
useIdeInit(project?.cadPackage, project?.code, 'viewer')
|
||||
const [newDescription, setNewDescription] = useState(project?.description)
|
||||
const onDescriptionChange = (description) => setNewDescription(description())
|
||||
|
||||
You should be able to import than re export QUERY from
app/web/src/components/IdeProjectCell/IdeProjectCell.tsxinstead of redefining it here (can import the Project type too)I don't mind having some duplication, but having more than one query with the same name
FIND_PROJECT_BY_USENAME_TITLEcan cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.You should be able to import than re export QUERY from
app/web/src/components/IdeProjectCell/IdeProjectCell.tsxinstead of redefining it here (can import the Project type too)I don't mind having some duplication, but having more than one query with the same name
FIND_PROJECT_BY_USENAME_TITLEcan cause issues with apollo, if you don't want to import the query could you atleast rename to something unique.Ah nice thank you, complete.
Ah nice thank you, complete.