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
|
||||
|
||||
@@ -56,6 +56,7 @@ const Routes = () => {
|
||||
<Route path="/u/{userName}" page={UserPage} name="user" />
|
||||
<Route path="/u/{userName}/{projectTitle}" page={ProjectPage} name="project" />
|
||||
<Route path="/u/{userName}/{projectTitle}/ide" page={IdeProjectPage} name="ide" />
|
||||
<Route path="/u/{userName}/{projectTitle}/embed" page={EmbedProjectPage} name="embed" />
|
||||
<Route path="/u/{userName}/{projectTitle}/social-card" page={SocialCardPage} name="socialCard" />
|
||||
|
||||
<Private unauthenticated="home" role="admin">
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// Define your own mock data here:
|
||||
export const standard = (/* vars, { ctx, req } */) => ({
|
||||
ideProject: {
|
||||
id: 42,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Loading, Empty, Success } from './EmbedProjectCell'
|
||||
import { standard } from './EmbedProjectCell.mock'
|
||||
|
||||
export const loading = () => {
|
||||
return Loading ? <Loading /> : null
|
||||
}
|
||||
|
||||
export const empty = () => {
|
||||
return Empty ? <Empty /> : null
|
||||
}
|
||||
|
||||
export const success = () => {
|
||||
return Success ? <Success {...standard()} /> : null
|
||||
}
|
||||
|
||||
export default { title: 'Cells/EmbedProjectCell' }
|
||||
@@ -0,0 +1,21 @@
|
||||
import { render, screen } from '@redwoodjs/testing'
|
||||
import { Loading, Empty, Success } from './EmbedProjectCell'
|
||||
import { standard } from './EmbedProjectCell.mock'
|
||||
|
||||
describe('EmbedProjectCell', () => {
|
||||
test('Loading renders successfully', () => {
|
||||
render(<Loading />)
|
||||
// Use screen.debug() to see output
|
||||
expect(screen.getByText('Loading...')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
test('Empty renders successfully', async () => {
|
||||
render(<Empty />)
|
||||
expect(screen.getByText('Empty')).toBeInTheDocument()
|
||||
})
|
||||
|
||||
test('Success renders successfully', async () => {
|
||||
render(<Success ideProject={standard().ideProject} />)
|
||||
expect(screen.getByText(/42/i)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
71
app/web/src/components/EmbedProjectCell/EmbedProjectCell.tsx
Normal file
@@ -0,0 +1,71 @@
|
||||
|
|
||||
import useUser from 'src/helpers/hooks/useUser'
|
||||
|
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.
|
||||
import EmbedViewer from 'src/components/EmbedViewer/EmbedViewer'
|
||||
|
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.
|
||||
import { useIdeState } from 'src/helpers/hooks/useIdeState'
|
||||
|
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.
|
||||
import { IdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||
|
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.
|
||||
export const QUERY = gql`
|
||||
|
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.
|
||||
query FIND_PROJECT_BY_USENAME_TITLE(
|
||||
|
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.
|
||||
$projectTitle: String!
|
||||
|
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.
|
||||
$userName: String!
|
||||
|
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.
|
||||
project: projectByUserAndTitle(
|
||||
|
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.
|
||||
projectTitle: $projectTitle
|
||||
|
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.
|
||||
userName: $userName
|
||||
|
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.
|
||||
id
|
||||
|
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.
|
||||
title
|
||||
|
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.
|
||||
description
|
||||
|
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.
|
||||
code
|
||||
|
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.
|
||||
mainImage
|
||||
|
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.
|
||||
createdAt
|
||||
|
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.
|
||||
cadPackage
|
||||
|
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.
|
||||
user {
|
||||
|
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.
|
||||
id
|
||||
|
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.
|
||||
userName
|
||||
|
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.
|
||||
image
|
||||
|
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.
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.
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.
|
||||
export interface Project {
|
||||
|
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.
|
||||
id: string
|
||||
|
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.
|
||||
title: string
|
||||
|
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.
|
||||
code: string
|
||||
|
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.
|
||||
description: string
|
||||
|
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.
|
||||
mainImage: string
|
||||
|
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.
|
||||
createdAt: string
|
||||
|
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.
|
||||
cadPackage: 'openscad' | 'cadquery'
|
||||
|
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.
|
||||
user: {
|
||||
|
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.
|
||||
id: string
|
||||
|
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.
|
||||
userName: string
|
||||
|
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.
|
||||
image: string
|
||||
|
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.
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.
|
||||
export const Loading = () => <div>Loading...</div>
|
||||
|
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.
|
||||
export const Empty = () => <div>Project not found</div>
|
||||
|
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.
|
||||
interface SaveCodeArgs {
|
||||
|
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.
|
||||
input: any
|
||||
|
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.
|
||||
id: string
|
||||
|
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.
|
||||
isFork: boolean
|
||||
|
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.
Ah nice thank you, complete. Ah nice thank you, complete.
|
||||
export const Success = ({
|
||||
|
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.
|
||||
project,
|
||||
|
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.
|
||||
refetch,
|
||||
|
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.
|
||||
project: Project
|
||||
|
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.
|
||||
refetch: any
|
||||
|
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.
|
||||
const [state, thunkDispatch] = useIdeState()
|
||||
|
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.
Ah nice thank you, complete. Ah nice thank you, complete.
|
||||
return (
|
||||
|
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.
|
||||
<IdeContext.Provider value={{ state, thunkDispatch, project }}>
|
||||
|
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.
|
||||
<EmbedViewer />
|
||||
|
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.
|
||||
</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.
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
|
||||
@@ -35,7 +37,7 @@ const IdeViewer = ({
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<PureIdeViewer
|
||||
dataType={dataType}
|
||||
@@ -44,6 +46,7 @@ const IdeViewer = ({
|
||||
onCameraChange={onCameraChange}
|
||||
isLoading={state.isLoading}
|
||||
camera={state?.camera}
|
||||
isMinimal={isMinimal}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
11
app/web/src/pages/EmbedProjectPage/EmbedProjectPage.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import EmbedProjectCell from 'src/components/EmbedProjectCell'
|
||||
|
||||
const EmbedProjectPage = ({ userName, projectTitle }) => {
|
||||
return (
|
||||
<>
|
||||
<EmbedProjectCell userName={userName} projectTitle={projectTitle} />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default EmbedProjectPage
|
||||
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.