Merge pull request #415 from Irev-Dev/kurt/409-update-title-and-more
Kurt/409 update title and more
This commit was merged in pull request #415.
This commit is contained in:
@@ -60,7 +60,6 @@ const CaptureButton = ({ canEdit, TheButton, shouldUpdateImage }) => {
|
|||||||
})
|
})
|
||||||
updateCanvasSize(oldSize)
|
updateCanvasSize(oldSize)
|
||||||
} else {
|
} else {
|
||||||
console.log(project?.title)
|
|
||||||
imgBlob = state.objectData.data
|
imgBlob = state.objectData.data
|
||||||
}
|
}
|
||||||
const config = {
|
const config = {
|
||||||
|
|||||||
@@ -36,8 +36,12 @@ const EditableProjectTitle = ({
|
|||||||
toast.success('Project updated.')
|
toast.success('Project updated.')
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
const onTitleChange = ({ target }) =>
|
const onTitleChange = ({ target }) => {
|
||||||
setNewTitle(target.value.replace(/([^a-zA-Z\d_:])/g, '-'))
|
if (target.value.length > 25) {
|
||||||
|
toast.error('Titles must be 25 or less characters')
|
||||||
|
}
|
||||||
|
setNewTitle(target.value.replace(/([^a-zA-Z\d_:])/g, '-').slice(0, 25))
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!inEditMode && (
|
{!inEditMode && (
|
||||||
@@ -68,7 +72,7 @@ const EditableProjectTitle = ({
|
|||||||
<span className="flex items-center ml-4 border border-ch-gray-300 rounded-sm">
|
<span className="flex items-center ml-4 border border-ch-gray-300 rounded-sm">
|
||||||
<span className="ml-1">/</span>
|
<span className="ml-1">/</span>
|
||||||
<input
|
<input
|
||||||
className="pl-1 bg-ch-gray-900"
|
className="pl-1 w-64 bg-ch-gray-900"
|
||||||
value={newTitle}
|
value={newTitle}
|
||||||
onChange={onTitleChange}
|
onChange={onTitleChange}
|
||||||
ref={inputRef}
|
ref={inputRef}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const SmallLoadingPing = (
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
||||||
const BigLoadingPing = () => (
|
export const BigLoadingPing = (
|
||||||
<div className="inset-0 absolute flex items-center justify-center bg-ch-gray-800">
|
<div className="inset-0 absolute flex items-center justify-center bg-ch-gray-800">
|
||||||
<div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div>
|
<div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -36,14 +36,13 @@ function Controls({ onCameraChange, onDragStart, onInit }) {
|
|||||||
const { camera, gl } = threeInstance
|
const { camera, gl } = threeInstance
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
onInit(threeInstance)
|
onInit(threeInstance)
|
||||||
}, [])
|
|
||||||
useEffect(() => {
|
|
||||||
// init camera position
|
// init camera position
|
||||||
camera.position.x = 200
|
camera.position.x = 200
|
||||||
camera.position.y = 140
|
camera.position.y = 140
|
||||||
camera.position.z = 20
|
camera.position.z = 20
|
||||||
camera.far = 10000
|
camera.far = 10000
|
||||||
camera.fov = 22.5 // matches default openscad fov
|
camera.fov = 22.5 // matches default openscad fov
|
||||||
|
camera.updateProjectionMatrix()
|
||||||
|
|
||||||
// Order matters with Euler rotations
|
// Order matters with Euler rotations
|
||||||
// We want it to rotate around the z or vertical axis first then the x axis to match openscad
|
// We want it to rotate around the z or vertical axis first then the x axis to match openscad
|
||||||
@@ -163,7 +162,7 @@ const IdeViewer = ({ Loading }) => {
|
|||||||
const indigo900 = '#312E81'
|
const indigo900 = '#312E81'
|
||||||
return (
|
return (
|
||||||
<div className="relative h-full bg-ch-gray-800">
|
<div className="relative h-full bg-ch-gray-800">
|
||||||
{state.isLoading && <Loading />}
|
{state.isLoading && Loading}
|
||||||
{image && (
|
{image && (
|
||||||
<div
|
<div
|
||||||
className={`absolute inset-0 transition-opacity duration-500 ${
|
className={`absolute inset-0 transition-opacity duration-500 ${
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import IdeSideBar from 'src/components/IdeSideBar/IdeSideBar'
|
|||||||
import IdeHeader from 'src/components/IdeHeader/IdeHeader'
|
import IdeHeader from 'src/components/IdeHeader/IdeHeader'
|
||||||
import Svg from 'src/components/Svg/Svg'
|
import Svg from 'src/components/Svg/Svg'
|
||||||
import { useIdeInit } from 'src/components/EncodedUrl/helpers'
|
import { useIdeInit } from 'src/components/EncodedUrl/helpers'
|
||||||
import type { Project } from 'src/components/IdeProjectCell/IdeProjectCell'
|
|
||||||
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
|
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||||
import { useSaveCode } from 'src/components/IdeWrapper/useSaveCode'
|
import { useSaveCode } from 'src/components/IdeWrapper/useSaveCode'
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const useSaveCode = () => {
|
|||||||
if (!!error !== nowError) {
|
if (!!error !== nowError) {
|
||||||
setNowError(!!error)
|
setNowError(!!error)
|
||||||
}
|
}
|
||||||
if (project?.user?.id !== currentUser?.sub) {
|
if (!currentUser || project?.user?.id !== currentUser?.sub) {
|
||||||
return () => console.log('not your project')
|
return () => console.log('not your project')
|
||||||
}
|
}
|
||||||
return (input: Prisma.ProjectUpdateInput) => {
|
return (input: Prisma.ProjectUpdateInput) => {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import Popover from '@material-ui/core/Popover'
|
|||||||
import useUser from 'src/helpers/hooks/useUser'
|
import useUser from 'src/helpers/hooks/useUser'
|
||||||
import ImageUploader from 'src/components/ImageUploader'
|
import ImageUploader from 'src/components/ImageUploader'
|
||||||
import LoginModal from 'src/components/LoginModal'
|
import LoginModal from 'src/components/LoginModal'
|
||||||
|
import Gravatar from 'src/components//Gravatar/Gravatar'
|
||||||
|
|
||||||
const ProfileSlashLogin = () => {
|
const ProfileSlashLogin = () => {
|
||||||
const { logOut, isAuthenticated, currentUser, client } = useAuth()
|
const { logOut, isAuthenticated, currentUser, client } = useAuth()
|
||||||
@@ -43,21 +44,14 @@ const ProfileSlashLogin = () => {
|
|||||||
<div className="flex-shrink-0">
|
<div className="flex-shrink-0">
|
||||||
{isAuthenticated ? (
|
{isAuthenticated ? (
|
||||||
<div
|
<div
|
||||||
className="h-8 w-8 border-2 rounded-full border-gray-200 relative text-indigo-200"
|
className="h-8 w-8 relative text-indigo-200"
|
||||||
aria-describedby={popoverId}
|
aria-describedby={popoverId}
|
||||||
>
|
>
|
||||||
<button
|
<button
|
||||||
className="absolute inset-0 w-full h-full"
|
className="absolute inset-0 w-full h-full"
|
||||||
onClick={togglePopover}
|
onClick={togglePopover}
|
||||||
>
|
>
|
||||||
{!loading && (
|
{!loading && <Gravatar image={user?.image} />}
|
||||||
<ImageUploader
|
|
||||||
className="rounded-full object-cover"
|
|
||||||
aspectRatio={1}
|
|
||||||
imageUrl={user?.image}
|
|
||||||
width={80}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
@@ -1,12 +1,7 @@
|
|||||||
import { lazy, Suspense } from 'react'
|
import { lazy, Suspense } from 'react'
|
||||||
const IdeViewer = lazy(() => import('src/components/IdeViewer/IdeViewer'))
|
const IdeViewer = lazy(() => import('src/components/IdeViewer/IdeViewer'))
|
||||||
import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
|
import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
|
||||||
|
import { BigLoadingPing } from 'src/components/IdeContainer/IdeContainer'
|
||||||
const BigLoadingPing = () => (
|
|
||||||
<div className="inset-0 absolute flex items-center justify-center bg-ch-gray-800">
|
|
||||||
<div className="h-16 w-16 bg-pink-600 rounded-full animate-ping"></div>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
|
|
||||||
const ProfileViewer = () => {
|
const ProfileViewer = () => {
|
||||||
const { viewerDomRef } = use3dViewerResize()
|
const { viewerDomRef } = use3dViewerResize()
|
||||||
|
|||||||
@@ -6,7 +6,10 @@ const UPDATE_PROJECT_MUTATION_HOOK = gql`
|
|||||||
$input: UpdateProjectInput!
|
$input: UpdateProjectInput!
|
||||||
) {
|
) {
|
||||||
updateProject: updateProject(id: $id, input: $input) {
|
updateProject: updateProject(id: $id, input: $input) {
|
||||||
id
|
title
|
||||||
|
user {
|
||||||
|
userName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const DevIdePage = ({ cadPackage, project }: Props) => {
|
|||||||
/>
|
/>
|
||||||
<Toaster timeout={9000} />
|
<Toaster timeout={9000} />
|
||||||
<IdeContext.Provider value={{ state, thunkDispatch, project }}>
|
<IdeContext.Provider value={{ state, thunkDispatch, project }}>
|
||||||
<IdeWrapper cadPackage={cadPackage} />
|
<IdeWrapper cadPackage={cadPackage.toLocaleLowerCase()} />
|
||||||
</IdeContext.Provider>
|
</IdeContext.Provider>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import ProjectCell from 'src/components/ProjectCell'
|
|||||||
import Seo from 'src/components/Seo/Seo'
|
import Seo from 'src/components/Seo/Seo'
|
||||||
import { useIdeState } from 'src/helpers/hooks/useIdeState'
|
import { useIdeState } from 'src/helpers/hooks/useIdeState'
|
||||||
import { IdeContext } from 'src/helpers/hooks/useIdeContext'
|
import { IdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||||
|
import { Toaster } from '@redwoodjs/web/toast'
|
||||||
|
|
||||||
const ProjectPage = ({ userName, projectTitle }) => {
|
const ProjectPage = ({ userName, projectTitle }) => {
|
||||||
const { currentUser } = useAuth()
|
const { currentUser } = useAuth()
|
||||||
@@ -11,6 +12,7 @@ const ProjectPage = ({ userName, projectTitle }) => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Seo title={projectTitle} description={projectTitle} lang="en-US" />
|
<Seo title={projectTitle} description={projectTitle} lang="en-US" />
|
||||||
|
<Toaster timeout={1500} />
|
||||||
<IdeContext.Provider value={{ state, thunkDispatch, project: null }}>
|
<IdeContext.Provider value={{ state, thunkDispatch, project: null }}>
|
||||||
<ProjectCell
|
<ProjectCell
|
||||||
userName={userName}
|
userName={userName}
|
||||||
|
|||||||
Reference in New Issue
Block a user