diff --git a/checkmark.svg b/checkmark.svg deleted file mode 100644 index 5d4c32b..0000000 --- a/checkmark.svg +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/refresh.svg b/refresh.svg new file mode 100644 index 0000000..c4c702b --- /dev/null +++ b/refresh.svg @@ -0,0 +1,3 @@ + diff --git a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js index a85bc22..e7e37e8 100644 --- a/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js +++ b/web/src/components/IdeCascadeStudio/IdeCascadeStudio.js @@ -76,28 +76,27 @@ const IdeCascadeStudio = ({ part, saveCode, loading }) => { // Get the canvas image as a Data URL const imgBlob = await CascadeController.capture(threejsViewport.environment) - // // Upload the image to Cloudinary - // const cloudinaryImg = await uploadToCloudinary(imgBlob) + async function uploadAndUpdateImage(){ + // Upload the image to Cloudinary + const cloudinaryImg = await uploadToCloudinary(imgBlob) - // // TODO: Save the screenshot as the mainImage if none has been set - // // If it has been set, pass along the Blob without uploading - // if (!part.mainImage) { - // saveCode({ - // input: { - // code, - // title: part?.title, - // userId: currentUser?.sub, - // description: part?.description, - // mainImage: cloudinaryImg.public_id, - // }, - // id: part.id, - // isFork: !canEdit, - // }) - // } else { - // console.log('not saving, passing back into IDE', cloudinaryImg) - // } + // Save the screenshot as the mainImage + saveCode({ + input: { + code, + title: part?.title, + userId: currentUser?.sub, + description: part?.description, + mainImage: cloudinaryImg.public_id, + }, + id: part.id, + isFork: !canEdit, + }) - return imgBlob + return cloudinaryImg + } + + return { image: imgBlob, mainImage: part.mainImage, callback: uploadAndUpdateImage} }} /> diff --git a/web/src/components/IdeToolbar/IdeToolbar.js b/web/src/components/IdeToolbar/IdeToolbar.js index 4f8ab54..acfb543 100644 --- a/web/src/components/IdeToolbar/IdeToolbar.js +++ b/web/src/components/IdeToolbar/IdeToolbar.js @@ -106,11 +106,6 @@ const IdeToolbar = ({ setIsLoginModalOpen(true) } - const captureScreenshot = async () => { - setCaptureState(await onCapture()) - // console.log({ onCapture: onCapture() }) - } - const handleDownload = (imgBlob) => { const aTag = document.createElement('a') document.body.appendChild(aTag) @@ -260,16 +255,27 @@ const IdeToolbar = ({ { !captureState ? 'Loading...' :