Add "STL Download" to project profile page (#585)

* Moved EditorMenu/helpers.ts file to src/helpers. Reused STL download helper on a new button in the project profile page

* Tweak download STL style - flex-wrap the column and grow original "built with" content so the button is pushed write but remains responsive on smaller screens
This commit was merged in pull request #585.
This commit is contained in:
Scott Martin
2022-01-10 14:48:20 -05:00
committed by GitHub
parent 35fcd55229
commit e7dec57644
6 changed files with 49 additions and 9 deletions

View File

@@ -2,6 +2,7 @@ import { useMutation } from '@redwoodjs/web'
import { toast } from '@redwoodjs/web/toast'
import { navigate, routes } from '@redwoodjs/router'
import { useAuth } from '@redwoodjs/auth'
import { makeStlDownloadHandler } from 'src/helpers/download_stl'
import { useIdeState } from 'src/helpers/hooks/useIdeState'
import { IdeContext } from 'src/helpers/hooks/useIdeContext'
import { CREATE_PROJECT_MUTATION } from 'src/components/NavPlusButton/NavPlusButton'
@@ -192,6 +193,15 @@ 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.title }.stl`,
thunkDispatch,
})
return (
<IdeContext.Provider
value={{
@@ -213,6 +223,7 @@ export const Success = ({ userProject, refetch }) => {
onDelete={onDelete}
onReaction={onReaction}
onComment={onComment}
onStlDownload={onStlDownload}
/>
</IdeContext.Provider>
)