Fix pre-render fail
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
import { ideTypeNameMap } from 'src/helpers/hooks/useIdeContext'
|
export type CadPackageType = 'openscad' | 'cadquery' | 'jscad'
|
||||||
import type { CadPackage as CadPackageType } from 'src/helpers/hooks/useIdeState'
|
|
||||||
|
export const ideTypeNameMap = {
|
||||||
|
openscad: 'OpenSCAD',
|
||||||
|
cadquery: 'CadQuery',
|
||||||
|
}
|
||||||
|
|
||||||
interface CadPackageProps {
|
interface CadPackageProps {
|
||||||
cadPackage: CadPackageType
|
cadPackage: CadPackageType
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useState } from 'react'
|
import { useState } from 'react'
|
||||||
import { useIdeContext, ideTypeNameMap } from 'src/helpers/hooks/useIdeContext'
|
import { useIdeContext } from 'src/helpers/hooks/useIdeContext'
|
||||||
|
import { ideTypeNameMap } from 'src/components/CadPackage/CadPackage'
|
||||||
import OutBound from 'src/components/OutBound/OutBound'
|
import OutBound from 'src/components/OutBound/OutBound'
|
||||||
import { prepareEncodedUrl, makeExternalUrl } from './helpers'
|
import { prepareEncodedUrl, makeExternalUrl } from './helpers'
|
||||||
import { copyTextToClipboard } from 'src/helpers/clipboard'
|
import { copyTextToClipboard } from 'src/helpers/clipboard'
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { makeCodeStoreKey, requestRender } from 'src/helpers/hooks/useIdeState'
|
|||||||
import Editor, { useMonaco } from '@monaco-editor/react'
|
import Editor, { useMonaco } from '@monaco-editor/react'
|
||||||
import { theme } from 'src/../config/tailwind.config'
|
import { theme } from 'src/../config/tailwind.config'
|
||||||
import { useSaveCode } from 'src/components/IdeWrapper/useSaveCode'
|
import { useSaveCode } from 'src/components/IdeWrapper/useSaveCode'
|
||||||
import type { CadPackage as CadPackageType } from 'src/helpers/hooks/useIdeState'
|
import type { CadPackageType } from 'src/components/CadPackage/CadPackage'
|
||||||
|
|
||||||
const colors = theme.extend.colors
|
const colors = theme.extend.colors
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { Link, routes } from '@redwoodjs/router'
|
import { Link, routes } from '@redwoodjs/router'
|
||||||
import Svg from 'src/components/Svg/Svg'
|
import Svg from 'src/components/Svg/Svg'
|
||||||
import { Popover } from '@headlessui/react'
|
import { Popover } from '@headlessui/react'
|
||||||
import type { CadPackage } from 'src/helpers/hooks/useIdeState'
|
import type { CadPackageType } from 'src/components/CadPackage/CadPackage'
|
||||||
|
|
||||||
const menuOptions: {
|
const menuOptions: {
|
||||||
name: string
|
name: string
|
||||||
sub: string
|
sub: string
|
||||||
ideType: CadPackage
|
ideType: CadPackageType
|
||||||
}[] = [
|
}[] = [
|
||||||
{
|
{
|
||||||
name: 'OpenSCAD',
|
name: 'OpenSCAD',
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { DefaultKernelExport } from './common'
|
import { DefaultKernelExport } from './common'
|
||||||
import type { CadPackage } from 'src/helpers/hooks/useIdeState'
|
import type { CadPackageType } from 'src/components/CadPackage/CadPackage'
|
||||||
|
|
||||||
import openscad from './openScad/openScadController'
|
import openscad from './openScad/openScadController'
|
||||||
import cadquery from './cadQueryController'
|
import cadquery from './cadQueryController'
|
||||||
import jscad from './jsCad/jsCadController'
|
import jscad from './jsCad/jsCadController'
|
||||||
|
|
||||||
export const cadPackages: { [key in CadPackage]: DefaultKernelExport } = {
|
export const cadPackages: { [key in CadPackageType]: DefaultKernelExport } = {
|
||||||
openscad,
|
openscad,
|
||||||
cadquery,
|
cadquery,
|
||||||
jscad,
|
jscad,
|
||||||
|
|||||||
@@ -17,8 +17,3 @@ export const IdeContext = createContext<IdeContextType>({
|
|||||||
export function useIdeContext() {
|
export function useIdeContext() {
|
||||||
return useContext(IdeContext)
|
return useContext(IdeContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ideTypeNameMap = {
|
|
||||||
openscad: 'OpenSCAD',
|
|
||||||
cadquery: 'CadQuery',
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -13,10 +13,9 @@ function withThunk(dispatch, getState) {
|
|||||||
? actionOrThunk(dispatch, getState)
|
? actionOrThunk(dispatch, getState)
|
||||||
: dispatch(actionOrThunk)
|
: dispatch(actionOrThunk)
|
||||||
}
|
}
|
||||||
|
import { CadPackageType } from 'src/components/CadPackage/CadPackage'
|
||||||
|
|
||||||
export type CadPackage = 'openscad' | 'cadquery' | 'jscad'
|
const initCodeMap: { [key in CadPackageType]: string } = {
|
||||||
|
|
||||||
const initCodeMap: { [key in CadPackage]: string } = {
|
|
||||||
openscad: `// involute donut
|
openscad: `// involute donut
|
||||||
|
|
||||||
// ^ first comment is used for download title (i.e "involute-donut.stl")
|
// ^ first comment is used for download title (i.e "involute-donut.stl")
|
||||||
@@ -97,7 +96,7 @@ interface XYZ {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface State {
|
export interface State {
|
||||||
ideType: 'INIT' | CadPackage
|
ideType: 'INIT' | CadPackageType
|
||||||
consoleMessages: { type: 'message' | 'error'; message: string; time: Date }[]
|
consoleMessages: { type: 'message' | 'error'; message: string; time: Date }[]
|
||||||
code: string
|
code: string
|
||||||
objectData: {
|
objectData: {
|
||||||
|
|||||||
Reference in New Issue
Block a user