diff --git a/app/web/src/components/Hero/Hero.tsx b/app/web/src/components/Hero/Hero.tsx
index 2a896de..be731d9 100644
--- a/app/web/src/components/Hero/Hero.tsx
+++ b/app/web/src/components/Hero/Hero.tsx
@@ -11,6 +11,7 @@ import Svg, { SvgNames } from 'src/components/Svg/Svg'
import Gravatar from 'src/components/Gravatar/Gravatar'
import ProjectsCell from 'src/components/ProjectsCell'
import OutBound from 'src/components/OutBound/OutBound'
+import { DynamicProjectButton } from 'src/components/NavPlusButton/NavPlusButton'
// dynamic import to enable pre-render iof the homepage
const AssetWithGooey = React.lazy(
@@ -345,15 +346,12 @@ function ChooseYourCharacter() {
}) => (
-
+
{desc}
diff --git a/app/web/src/components/NavPlusButton/NavPlusButton.tsx b/app/web/src/components/NavPlusButton/NavPlusButton.tsx
index f9823d3..d36346e 100644
--- a/app/web/src/components/NavPlusButton/NavPlusButton.tsx
+++ b/app/web/src/components/NavPlusButton/NavPlusButton.tsx
@@ -21,6 +21,52 @@ export const CREATE_PROJECT_MUTATION = gql`
}
`
+export function DynamicProjectButton({ children, ideType, className }) {
+ const { isAuthenticated } = useAuth()
+ const { user } = useUser()
+ const [createProject] = useMutation(CREATE_PROJECT_MUTATION, {})
+ const handleCreate = async (ideType) => {
+ const projectPromise = createProject({
+ variables: { input: { userId: user.id, cadPackage: ideType } },
+ })
+ toast.promise(projectPromise, {
+ loading: 'creating Project',
+ success: Initializing,
+ error: Problem creating.,
+ })
+ const {
+ data: { createProject: project },
+ } = await projectPromise
+ navigate(
+ routes.ide({
+ userName: project?.user?.userName,
+ projectTitle: project?.title,
+ })
+ )
+ }
+ const ButtonWrap = ({ children, ideType, className }) =>
+ isAuthenticated && user ? (
+
+ ) : (
+
+ {children}
+
+ )
+ return (
+
+ {children}
+
+ )
+}
+
const menuOptions: {
name: string
sub: string
@@ -52,36 +98,6 @@ const menuOptions: {
]
const NavPlusButton: React.FC = () => {
- const { isAuthenticated } = useAuth()
- const { user } = useUser()
- const [createProject] = useMutation(CREATE_PROJECT_MUTATION, {})
- const handleCreate = async (ideType) => {
- const projectPromise = createProject({
- variables: { input: { userId: user.id, cadPackage: ideType } },
- })
- toast.promise(projectPromise, {
- loading: 'creating Project',
- success: Initializing,
- error: Problem creating.,
- })
- const {
- data: { createProject: project },
- } = await projectPromise
- navigate(
- routes.ide({
- userName: project?.user?.userName,
- projectTitle: project?.title,
- })
- )
- }
- const ButtonWrap = ({ children, ideType }) =>
- isAuthenticated && user ? (
-
- ) : (
- {children}
- )
return (
@@ -106,10 +122,10 @@ const NavPlusButton: React.FC = () => {
dotClasses + ' justify-self-center w-5 h-5 rounded-full'
}
>
-
+
{name}
{sub}
-
+
))}