diff --git a/app/api/src/functions/graphql.ts b/app/api/src/functions/graphql.ts
index 347394a..667252f 100644
--- a/app/api/src/functions/graphql.ts
+++ b/app/api/src/functions/graphql.ts
@@ -1,7 +1,7 @@
import { createGraphQLHandler } from '@redwoodjs/graphql-server'
import { createSentryApolloPlugin } from 'src/lib/sentry'
import { logger } from 'src/lib/logger'
-import "discord.js"
+import 'discord.js'
import directives from 'src/directives/**/*.{js,ts}'
import sdls from 'src/graphql/**/*.sdl.{js,ts}'
diff --git a/app/api/src/lib/discord.ts b/app/api/src/lib/discord.ts
index 649566e..127a03b 100644
--- a/app/api/src/lib/discord.ts
+++ b/app/api/src/lib/discord.ts
@@ -1,34 +1,40 @@
-import {Client, Intents, MessageAttachment} from "discord.js"
+import { Client, Intents, MessageAttachment } from 'discord.js'
-const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]})
+const client = new Client({
+ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
+})
export async function sendDiscordMessage(text: string, url?: string) {
if (!client.isReady()) {
- console.error(`Discord: client is not ready to send message ("${text}")`);
+ console.error(`Discord: client is not ready to send message ("${text}")`)
} else {
- const channel = await client.channels.fetch(process.env.DISCORD_CHANNEL_ID);
+ const channel = await client.channels.fetch(process.env.DISCORD_CHANNEL_ID)
if (url) {
- channel.send({ embeds: [{
- title: text,
- image: {
- url: url,
- },
- }] });
-
+ channel.send({
+ embeds: [
+ {
+ title: text,
+ image: {
+ url: url,
+ },
+ },
+ ],
+ })
} else {
channel.send(text)
}
-
}
}
-client.on("ready", async () => {
+client.on('ready', async () => {
console.log(`Discord: logged in as ${client.user.tag}`)
})
if (!process.env.DISCORD_TOKEN || !process.env.DISCORD_CHANNEL_ID) {
- console.warn("Discord bot not configured - please set process.env.DISCORD_TOKEN and process.env.DISCORD_CHANNEL_ID to send discord chats");
+ console.warn(
+ 'Discord bot not configured - please set process.env.DISCORD_TOKEN and process.env.DISCORD_CHANNEL_ID to send discord chats'
+ )
} else {
- console.log(`Discord: logging in (token ${process.env.DISCORD_TOKEN})`);
- client.login(process.env.DISCORD_TOKEN);
+ console.log(`Discord: logging in (token ${process.env.DISCORD_TOKEN})`)
+ client.login(process.env.DISCORD_TOKEN)
}
diff --git a/app/api/src/services/projects/projects.ts b/app/api/src/services/projects/projects.ts
index 2660a67..9fbba54 100644
--- a/app/api/src/services/projects/projects.ts
+++ b/app/api/src/services/projects/projects.ts
@@ -14,7 +14,6 @@ import { requireAuth } from 'src/lib/auth'
import { requireOwnership, requireProjectOwnership } from 'src/lib/owner'
import { sendDiscordMessage } from 'src/lib/discord'
-
export const projects = ({ userName }) => {
if (!userName) {
return db.project.findMany({ where: { deleted: false } })
@@ -249,13 +248,16 @@ export const updateProjectImages = async ({
const { userName } = await db.user.findUnique({
where: { id: project.userId },
})
- sendDiscordMessage([
- `${userName} just added an image to their ${project.cadPackage} project:`,
- ` => ${project.title}`,
- ``,
- `Check it out, leave a comment, make them feel welcome!`,
- `https://cadhub.xyz/u/${userName}/${project.title}`
- ].join('\n'), `https://res.cloudinary.com/irevdev/image/upload/c_scale,w_700/v1/${mainImage}`)
+ sendDiscordMessage(
+ [
+ `${userName} just added an image to their ${project.cadPackage} project:`,
+ ` => ${project.title}`,
+ ``,
+ `Check it out, leave a comment, make them feel welcome!`,
+ `https://cadhub.xyz/u/${userName}/${project.title}`,
+ ].join('\n'),
+ `https://res.cloudinary.com/irevdev/image/upload/c_scale,w_700/v1/${mainImage}`
+ )
return result
})
return updatedProject
diff --git a/app/web/src/components/EditorMenu/menuConfig.tsx b/app/web/src/components/EditorMenu/menuConfig.tsx
index 1e6d41b..32e8669 100644
--- a/app/web/src/components/EditorMenu/menuConfig.tsx
+++ b/app/web/src/components/EditorMenu/menuConfig.tsx
@@ -1,6 +1,9 @@
import React from 'react'
import { useRender } from 'src/components/IdeWrapper/useRender'
-import { makeStlDownloadHandler, PullTitleFromFirstLine } from 'src/helpers/download_stl'
+import {
+ makeStlDownloadHandler,
+ PullTitleFromFirstLine,
+} from 'src/helpers/download_stl'
import { useSaveCode } from 'src/components/IdeWrapper/useSaveCode'
import { DropdownItem } from './Dropdowns'
import { useShortcutsModalContext } from './AllShortcutsModal'
diff --git a/app/web/src/components/EmbedProject/EmbedProject.tsx b/app/web/src/components/EmbedProject/EmbedProject.tsx
index a8ef33c..fd7e092 100644
--- a/app/web/src/components/EmbedProject/EmbedProject.tsx
+++ b/app/web/src/components/EmbedProject/EmbedProject.tsx
@@ -1,31 +1,30 @@
-import Seo from 'src/components/Seo/Seo'
-import IdeViewer from 'src/components/IdeViewer/IdeViewer'
-import { useIdeState } from 'src/helpers/hooks/useIdeState'
-import type { Project } from 'src/components/EmbedProjectCell/EmbedProjectCell'
-import { IdeContext } from 'src/helpers/hooks/useIdeContext'
-import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
-import { useEffect } from 'react'
-
-
-interface Props {
- project?: Project
-}
-
-const EmbedProject = ({ project }: Props) => {
- const [state, thunkDispatch] = useIdeState()
- const { viewerDomRef, handleViewerSizeUpdate } = use3dViewerResize()
-
- useEffect(() => {
- handleViewerSizeUpdate()
- }, [])
-
- return (
-
-
-
-
-
- )
-}
-
-export default EmbedProject
+import Seo from 'src/components/Seo/Seo'
+import IdeViewer from 'src/components/IdeViewer/IdeViewer'
+import { useIdeState } from 'src/helpers/hooks/useIdeState'
+import type { Project } from 'src/components/EmbedProjectCell/EmbedProjectCell'
+import { IdeContext } from 'src/helpers/hooks/useIdeContext'
+import { use3dViewerResize } from 'src/helpers/hooks/use3dViewerResize'
+import { useEffect } from 'react'
+
+interface Props {
+ project?: Project
+}
+
+const EmbedProject = ({ project }: Props) => {
+ const [state, thunkDispatch] = useIdeState()
+ const { viewerDomRef, handleViewerSizeUpdate } = use3dViewerResize()
+
+ useEffect(() => {
+ handleViewerSizeUpdate()
+ }, [])
+
+ return (
+
+
+
+
+
+ )
+}
+
+export default EmbedProject
diff --git a/app/web/src/components/EmbedProjectCell/EmbedProjectCell.tsx b/app/web/src/components/EmbedProjectCell/EmbedProjectCell.tsx
index d55e518..3cb2e6c 100644
--- a/app/web/src/components/EmbedProjectCell/EmbedProjectCell.tsx
+++ b/app/web/src/components/EmbedProjectCell/EmbedProjectCell.tsx
@@ -38,10 +38,9 @@ export const Success = ({
}) => {
const [state, thunkDispatch] = useIdeState()
-
return (
-
-
-
+
+
+
)
}
diff --git a/app/web/src/components/EmbedViewer/EmbedViewer.tsx b/app/web/src/components/EmbedViewer/EmbedViewer.tsx
index 77d3ed8..3ecee29 100644
--- a/app/web/src/components/EmbedViewer/EmbedViewer.tsx
+++ b/app/web/src/components/EmbedViewer/EmbedViewer.tsx
@@ -7,28 +7,44 @@ import LogoType from '../LogoType/LogoType'
import { Link, routes } from '@redwoodjs/router'
function EmbedViewer() {
- const { state, project } = useIdeContext()
- useIdeInit(project?.cadPackage, project?.code || state?.code, "viewer")
- const { viewerDomRef } = use3dViewerResize()
+ const { state, project } = useIdeContext()
+ useIdeInit(project?.cadPackage, project?.code || state?.code, 'viewer')
+ const { viewerDomRef } = use3dViewerResize()
- return (
-
-
-
-
- {project?.title.replace(/-/g, ' ')}
-
-
by @{ project?.user?.userName }
-
built with
-
-
- View on
-
-
- )
+ return (
+
+
+
+
+ {project?.title.replace(/-/g, ' ')}
+
+
+ by @{project?.user?.userName}
+
+
+ built with{' '}
+
+
+
+
+
+
+ View on{' '}
+
+
+
+
+
+ )
}
export default EmbedViewer
diff --git a/app/web/src/components/IdeViewer/IdeViewer.tsx b/app/web/src/components/IdeViewer/IdeViewer.tsx
index a5d2ce0..1f30310 100644
--- a/app/web/src/components/IdeViewer/IdeViewer.tsx
+++ b/app/web/src/components/IdeViewer/IdeViewer.tsx
@@ -6,8 +6,8 @@ const IdeViewer = ({
handleOwnCamera = false,
isMinimal = false,
}: {
- handleOwnCamera?: boolean,
- isMinimal?: boolean,
+ handleOwnCamera?: boolean
+ isMinimal?: boolean
}) => {
const { state, thunkDispatch } = useIdeContext()
const dataType = state.objectData?.type
@@ -43,7 +43,7 @@ const IdeViewer = ({
}
})
}
-
+
return (
-
- { (wrappedInLink
- ?
-
-
-
-
- :
- )}
-
-
-
-
- {/* Because of how specific these styles are to this heading/logo and it doesn't need to be replicated else where as well as it's very precise with the placement of "pre-alpha" I think it's appropriate. */}
-
- CadHub
-
-
- pre-alpha
-
-
-
-
-
- )
-}
\ No newline at end of file
+export default function LogoType({ className = '', wrappedInLink = false }) {
+ return (
+
+
+ {wrappedInLink ? (
+
+
+
+
+
+ ) : (
+
+ )}
+
+
+
+
+ {/* Because of how specific these styles are to this heading/logo and it doesn't need to be replicated else where as well as it's very precise with the placement of "pre-alpha" I think it's appropriate. */}
+
+ CadHub
+
+
+ pre-alpha
+
+
+
+
+
+ )
+}
diff --git a/app/web/src/components/ProjectCell/ProjectCell.tsx b/app/web/src/components/ProjectCell/ProjectCell.tsx
index fa51ca7..428fa24 100644
--- a/app/web/src/components/ProjectCell/ProjectCell.tsx
+++ b/app/web/src/components/ProjectCell/ProjectCell.tsx
@@ -194,13 +194,13 @@ export const Success = ({ userProject, refetch }) => {
})
const onStlDownload = makeStlDownloadHandler({
- type: state.objectData?.type,
- ideType: state.ideType,
- geometry: state.objectData?.data,
- quality: state.objectData?.quality,
- fileName: `${userProject.Project.title }.stl`,
- thunkDispatch,
- })
+ type: state.objectData?.type,
+ ideType: state.ideType,
+ geometry: state.objectData?.data,
+ quality: state.objectData?.quality,
+ fileName: `${userProject.Project.title}.stl`,
+ thunkDispatch,
+ })
return (
{
const { state } = useIdeContext()
- if ((state.ideType !== 'openscad' && state.ideType !== 'curv') || state.objectData?.type !== 'png') {
+ if (
+ (state.ideType !== 'openscad' && state.ideType !== 'curv') ||
+ state.objectData?.type !== 'png'
+ ) {
return null
}
- return state.ideType === 'openscad' ?
+ return state.ideType === 'openscad' ? (
Why reload each camera move?
- :
- Alpha Curv integration, no camera support currently.
-
+ ) : (
+
+ Alpha Curv integration, no camera support currently.
+
+ )
}
export default StaticImageMessage
diff --git a/app/web/src/helpers/cadPackages/jsCad/jscadWorker.ts b/app/web/src/helpers/cadPackages/jsCad/jscadWorker.ts
index 0a18cc4..f4eb77e 100644
--- a/app/web/src/helpers/cadPackages/jsCad/jscadWorker.ts
+++ b/app/web/src/helpers/cadPackages/jsCad/jscadWorker.ts
@@ -318,9 +318,11 @@ const makeScriptWorker = ({ callback, convertToSolids }) => {
let onInit, main, scriptStats, entities, lastParamsDef
function runMain(params = {}) {
- if(lastParamsDef) lastParamsDef.forEach(def=>{
- if(!(def.name in params) && 'initial' in def) params[def.name] = def.initial
- })
+ if (lastParamsDef)
+ lastParamsDef.forEach((def) => {
+ if (!(def.name in params) && 'initial' in def)
+ params[def.name] = def.initial
+ })
let time = Date.now()
let solids
const transfer = []