From 26aef0944d181e395c3ee1c05283afff875d2313 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Tue, 17 Nov 2020 07:00:27 +1100 Subject: [PATCH 1/5] Add read me banner --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 5d61b9f..d6c5f6b 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +![CadHub banner](https://raw.githubusercontent.com/Irev-Dev/repo-images/main/images/gear%20donutbanner.png) + # [C a d H u b](https://cadhub.xyz) [![Netlify Status](https://api.netlify.com/api/v1/badges/77f37543-e54a-4723-8136-157c0221ec27/deploy-status)](https://app.netlify.com/sites/cadhubxyz/deploys) From d0bdc459538b7f6e963be71869506d7c0a3db04c Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Tue, 17 Nov 2020 07:06:02 +1100 Subject: [PATCH 2/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6c5f6b..ed04c87 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Netlify Status](https://api.netlify.com/api/v1/badges/77f37543-e54a-4723-8136-157c0221ec27/deploy-status)](https://app.netlify.com/sites/cadhubxyz/deploys) -CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/). +CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/). OpenScad has proven code-cad a much loved formate for cad-modeling. Joining code-cad to a mature language like javascript that has a package manager (npm) plus a community hub for sharing cad models like CadHub, we're going to build a thriving community. From cad7c988a3308bd6dcac74e3a1684a5e15707b9f Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Tue, 17 Nov 2020 07:09:54 +1100 Subject: [PATCH 3/5] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ed04c87..5f6855a 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/). OpenScad has proven code-cad a much loved formate for cad-modeling. Joining code-cad to a mature language like javascript that has a package manager (npm) plus a community hub for sharing cad models like CadHub, we're going to build a thriving community. +If you want to be involved in anyway, swing by the [discord channel](https://discord.gg/SD7zFRNjGH). + From 9708afb1d2d985edbe285ac9d415f26bc25b6885 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Tue, 17 Nov 2020 07:34:43 +1100 Subject: [PATCH 4/5] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5f6855a..119b904 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ [![Netlify Status](https://api.netlify.com/api/v1/badges/77f37543-e54a-4723-8136-157c0221ec27/deploy-status)](https://app.netlify.com/sites/cadhubxyz/deploys) -CadHub aims to be a community website for javascript based code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but if successful plan to also integrate [JSCAD](https://openjscad.org/). -OpenScad has proven code-cad a much loved formate for cad-modeling. Joining code-cad to a mature language like javascript that has a package manager (npm) plus a community hub for sharing cad models like CadHub, we're going to build a thriving community. +CadHub aims to be a community website for code-cad. Currently trying to integrate the excellent [cascadeStudio](https://zalo.github.io/CascadeStudio/), but maybe more in future. +OpenScad has proven that code-cad is a much loved format for cad-modeling. We're going to build a thriving community. If you want to be involved in anyway, swing by the [discord channel](https://discord.gg/SD7zFRNjGH). From 5c177753a7789b4c67ae30735cf2ffd3c4f7bbd8 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Tue, 17 Nov 2020 18:14:51 +1100 Subject: [PATCH 5/5] hot patch --- web/src/cascade | 2 +- .../components/IdeCascadeStudio/IdeCascadeStudio.js | 4 +--- web/src/components/IdePartCell/IdePartCell.js | 1 + web/src/helpers/cascadeController.js | 12 +++++++----- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/web/src/cascade b/web/src/cascade index 93582a3..330374d 160000 --- a/web/src/cascade +++ b/web/src/cascade @@ -1 +1 @@ -Subproject commit 93582a351d17e8c90b40f2aa8523fc0f8b02c36a +Subproject commit 330374d5cdb7fdaba8d1bd674bbafce5ca93db3f diff --git a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js index 9a472f7..7f2a03a 100644 --- a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js +++ b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js @@ -4,8 +4,6 @@ import CascadeController from 'src/helpers/cascadeController' import IdeToolbar from 'src/components/IdeToolbar' import { useEffect, useState } from 'react' -const domNode = document.createElement('div').setAttribute('id', 'sickId') - const IdeCascadeStudio = ({ part, saveCode, loading, error }) => { const [code, setCode] = useState(part.code) const { currentUser } = useAuth() @@ -15,7 +13,7 @@ const IdeCascadeStudio = ({ part, saveCode, loading, error }) => { // "opening" and "closing" it for the ide part of the app by displaying none or block. Which is why this useEffect // returns a clean up function that hides the div again. const onCodeChange = (code) => setCode(code) - CascadeController.initialise(onCodeChange, part.code, domNode) + CascadeController.initialise(onCodeChange, part.code) const element = document.getElementById('cascade-container') element.setAttribute('style', 'display: block; opacity: 100%; overflow: hidden; height: calc(100vh - 8rem)') // eslint-disable-line return () => { diff --git a/web/src/components/IdePartCell/IdePartCell.js b/web/src/components/IdePartCell/IdePartCell.js index 83a87ef..6bbffcf 100644 --- a/web/src/components/IdePartCell/IdePartCell.js +++ b/web/src/components/IdePartCell/IdePartCell.js @@ -14,6 +14,7 @@ export const QUERY = gql` user { id userName + image } } } diff --git a/web/src/helpers/cascadeController.js b/web/src/helpers/cascadeController.js index b18cb59..b9c9bb9 100644 --- a/web/src/helpers/cascadeController.js +++ b/web/src/helpers/cascadeController.js @@ -8,17 +8,19 @@ class CascadeController { } initialise(onCodeChange, code) { + const onInit = () => { + const editor = getEditor() + editor.setValue(code) + editor.evaluateCode(false) + } // only inits on first call, after that it just updates the editor and revaluates code, maybe should rename? this.incomingOnCodeChang = onCodeChange if (!this._hasInitialised) { - initialize(this.controllerOnCodeChange, code) + initialize(this.controllerOnCodeChange, code, onInit) this._hasInitialised = true return } - const editor = getEditor() - editor.setValue(code) - editor.evaluateCode(false) - return this.domNode + onInit() } }