FEAT: Create basic model embed #588

Merged
franknoirot merged 7 commits from feat-embed into main 2022-01-11 07:30:15 +01:00
5 changed files with 26 additions and 4 deletions
Showing only changes of commit fbf1cf16e2 - Show all commits

View File

@@ -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

View File

@@ -68,4 +68,4 @@ export const Success = ({
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.
<EmbedProject project={project} />
</IdeContext.Provider>
)
}
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.
}
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
Irev-Dev commented 2022-01-10 20:36:32 +01:00 (Migrated from github.com)
Review

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 `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.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.
franknoirot commented 2022-01-11 03:07:30 +01:00 (Migrated from github.com)
Review

Ah nice thank you, complete.

Ah nice thank you, complete.

View 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

View File

@@ -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}

View File

@@ -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())