Prepare changes for review and preview build

This commit is contained in:
Kurt Hutten
2021-11-21 18:12:56 +11:00
parent b1ff7796b9
commit 0face9b9c1
6 changed files with 18 additions and 10 deletions

View File

@@ -37,8 +37,8 @@ model User {
enum CadPackage { enum CadPackage {
openscad openscad
cadquery cadquery
jscad // TODO #422, add jscad to db schema when were ready to enable saving of jscad projects jscad
curv // curv // TODO uncomment when ready for users to save curv projects
} }
model Project { model Project {

View File

@@ -25,6 +25,7 @@ const CaptureButtonViewer = ({
const threeInstance = React.useRef(null) const threeInstance = React.useRef(null)
const [dataType, dataTypeSetter] = useState(state?.objectData?.type) const [dataType, dataTypeSetter] = useState(state?.objectData?.type)
const [artifact, artifactSetter] = useState(state?.objectData?.data) const [artifact, artifactSetter] = useState(state?.objectData?.data)
const [ideType] = useState(state?.ideType)
const [isLoading, isLoadingSetter] = useState(false) const [isLoading, isLoadingSetter] = useState(false)
const [camera, cameraSetter] = useState<State['camera'] | null>(null) const [camera, cameraSetter] = useState<State['camera'] | null>(null)
const getThreeInstance = (_threeInstance) => { const getThreeInstance = (_threeInstance) => {
@@ -70,6 +71,7 @@ const CaptureButtonViewer = ({
isLoading={isLoading} isLoading={isLoading}
camera={camera} camera={camera}
isMinimal isMinimal
ideType={ideType}
/> />
) )
} }

View File

@@ -69,7 +69,7 @@ export const makeStlDownloadHandler =
} else { } else {
thunkDispatch((dispatch, getState) => { thunkDispatch((dispatch, getState) => {
const state = getState() const state = getState()
const specialCadProcess = ideType === 'openscad' && 'stl' const specialCadProcess = (ideType === 'openscad' || ideType === 'curv') && 'stl'
dispatch({ type: 'setLoading' }) dispatch({ type: 'setLoading' })
requestRender({ requestRender({
state, state,

View File

@@ -10,6 +10,7 @@ const IdeViewer = ({
const { state, thunkDispatch } = useIdeContext() const { state, thunkDispatch } = useIdeContext()
const dataType = state.objectData?.type const dataType = state.objectData?.type
const artifact = state.objectData?.data const artifact = state.objectData?.data
const ideType = state.ideType
const onInit = (threeInstance) => { const onInit = (threeInstance) => {
thunkDispatch({ type: 'setThreeInstance', payload: threeInstance }) thunkDispatch({ type: 'setThreeInstance', payload: threeInstance })
@@ -44,6 +45,7 @@ const IdeViewer = ({
onCameraChange={onCameraChange} onCameraChange={onCameraChange}
isLoading={state.isLoading} isLoading={state.isLoading}
camera={state?.camera} camera={state?.camera}
ideType={ideType}
/> />
) )
} }

View File

@@ -169,6 +169,7 @@ export function PureIdeViewer({
isMinimal = false, isMinimal = false,
scadRatio = 1, scadRatio = 1,
camera, camera,
ideType
}: { }: {
dataType: 'INIT' | ArtifactTypes dataType: 'INIT' | ArtifactTypes
artifact: any artifact: any
@@ -178,6 +179,7 @@ export function PureIdeViewer({
isMinimal?: boolean isMinimal?: boolean
scadRatio?: number scadRatio?: number
camera?: State['camera'] camera?: State['camera']
ideType?: State['ideType']
}) { }) {
const [isDragging, setIsDragging] = useState(false) const [isDragging, setIsDragging] = useState(false)
const [image, setImage] = useState() const [image, setImage] = useState()
@@ -216,6 +218,8 @@ export function PureIdeViewer({
)} )}
<div // eslint-disable-line jsx-a11y/no-static-element-interactions <div // eslint-disable-line jsx-a11y/no-static-element-interactions
className={`opacity-0 absolute inset-0 transition-opacity duration-500 ${ className={`opacity-0 absolute inset-0 transition-opacity duration-500 ${
ideType === 'curv' ? // TODO hide axes while curve doesn't have a controllable camera
'opacity-0' :
!(isDragging || dataType !== 'png') !(isDragging || dataType !== 'png')
? 'hover:opacity-50' ? 'hover:opacity-50'
: 'opacity-100' : 'opacity-100'

View File

@@ -95,13 +95,13 @@ const menuOptions: {
dotClasses: 'bg-yellow-300', dotClasses: 'bg-yellow-300',
ideType: 'jscad', ideType: 'jscad',
}, },
{ // { // TODO uncomment when ready for users to save curv projects
name: 'Curv', // name: 'Curv',
sub: 'beta', // sub: 'beta',
bgClasses: 'bg-ch-blue-700', // bgClasses: 'bg-ch-blue-700',
dotClasses: 'bg-blue-800', // dotClasses: 'bg-blue-800',
ideType: 'curv', // ideType: 'curv',
}, // },
] ]
const NavPlusButton: React.FC = () => { const NavPlusButton: React.FC = () => {