diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fd4f9ff..014721a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,9 +32,9 @@ Install dependencies yarn install ``` -Setting up the db, you'll need to have a postgres installed locally, you can [follow this guide](https://redwoodjs.com/docs/local-postgres-setup). +Setting up the db, you'll need to have a postgres installed locally, you can [follow this guide](https://redwoodjs.com/docs/local-postgres-setup). -Run the following +Run the following (Note: these commands require the `DATABASE_URL` env variable to be set. if you see no result when you run `echo $DATABASE_URL`, you can set it with a command like `export DATABASE_URL=postgres://postgres:somepassword@localhost`) ``` terminal yarn rw prisma migrate dev yarn rw prisma db seed diff --git a/app/web/src/components/EditorMenu/menuConfig.tsx b/app/web/src/components/EditorMenu/menuConfig.tsx index 4408ad9..1e6d41b 100644 --- a/app/web/src/components/EditorMenu/menuConfig.tsx +++ b/app/web/src/components/EditorMenu/menuConfig.tsx @@ -1,6 +1,6 @@ import React from 'react' import { useRender } from 'src/components/IdeWrapper/useRender' -import { makeStlDownloadHandler, PullTitleFromFirstLine } from './helpers' +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/ProjectCell/ProjectCell.tsx b/app/web/src/components/ProjectCell/ProjectCell.tsx index 8c41c20..5fafc4e 100644 --- a/app/web/src/components/ProjectCell/ProjectCell.tsx +++ b/app/web/src/components/ProjectCell/ProjectCell.tsx @@ -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 ( { onDelete={onDelete} onReaction={onReaction} onComment={onComment} + onStlDownload={onStlDownload} /> ) diff --git a/app/web/src/components/ProjectProfile/ProjectProfile.tsx b/app/web/src/components/ProjectProfile/ProjectProfile.tsx index bb8cd1b..6c893f3 100644 --- a/app/web/src/components/ProjectProfile/ProjectProfile.tsx +++ b/app/web/src/components/ProjectProfile/ProjectProfile.tsx @@ -25,6 +25,7 @@ const ProjectProfile = ({ onDelete, onReaction, onComment, + onStlDownload, }) => { const [comment, setComment] = useState('') const [isEditing, setIsEditing] = useState(false) @@ -91,12 +92,25 @@ const ProjectProfile = ({

{project?.title.replace(/-/g, ' ')}

-
- Built with - +
+
+ Built with + +
+
{(project?.description || hasPermissionToEdit) && ( ), + 'document-download': ( + + + + ), 'dots-vertical': (